diff options
author | liamfallon <liam.fallon@est.tech> | 2020-03-05 10:50:48 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2020-03-09 18:30:13 +0000 |
commit | 6bda5d7e4e80d1aefb4f19203361b7199448e70f (patch) | |
tree | b28a68625cec91c57f0383d185f73fdf165ab558 /testsuites/integration/integration-uservice-test/src/test/resources/policies | |
parent | f876b34ec297495df20394c248b899d610e1bcce (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-uservice-test/src/test/resources/policies')
11 files changed, 52 insertions, 39 deletions
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js index 54826ce7a..b3176b3ed 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); -executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties in:" + executor.getExecutionProperties()); var executionProperties = new java.util.Properties(); executor.getExecutionProperties().setProperty("goodbye", "mars"); -executor.logger.info("executionProperties out:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties out:" + executor.getExecutionProperties()); -var returnValue = executor.isTrue; +true; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js index 4596dd4b4..90d522575 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); -executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties in:" + executor.getExecutionProperties()); var executionProperties = new java.util.Properties(); executor.getExecutionProperties().clear(); -executor.logger.info("executionProperties out:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties out:" + executor.getExecutionProperties()); -var returnValue = executor.isTrue; +true; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js index ba807cf73..bdfd806bd 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); -executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties in:" + executor.getExecutionProperties()); var executionProperties = new java.util.Properties(); executor.getExecutionProperties().setProperty("hello", "world"); -executor.logger.info("executionProperties out:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties out:" + executor.getExecutionProperties()); -var returnValue = executor.isTrue; +true; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js index 6cae0ceb1..3ade84846 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js @@ -18,8 +18,9 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); +executor.logger.debug(executor.getInFields().toString()); +executor.logger.debug("executionProperties:" + executor.getExecutionProperties()); +executor.logger.debug(executor.getOutFields().toString()); -executor.logger.info("executionProperties:" + executor.getExecutionProperties()); - -var returnValue = executor.isTrue; +true; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js index 6cae0ceb1..a5806cd72 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js @@ -18,8 +18,10 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); +executor.logger.debug(executor.getInFields().toString()); +executor.logger.debug("executionProperties:" + executor.getExecutionProperties()); -executor.logger.info("executionProperties:" + executor.getExecutionProperties()); +executor.logger.debug(executor.getOutFields().toString()); -var returnValue = executor.isTrue; +true; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js index 2d934636a..12ec9aee1 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); -executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties in:" + executor.getExecutionProperties()); var executionProperties = new java.util.Properties(); executor.getExecutionProperties().remove("hello"); -executor.logger.info("executionProperties out:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties out:" + executor.getExecutionProperties()); -var returnValue = executor.isTrue; +true; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js index f41c7c02a..86838fe7c 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js @@ -18,13 +18,18 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); +executor.logger.debug(executor.getInFields().toString()); +executor.logger.debug("executionProperties:" + executor.getExecutionProperties()); -var returnValue = executor.isTrue; +executor.logger.debug("testToRun:" + executor.getInFields().get("testToRun")); -executor.logger.info("executionProperties:" + executor.getExecutionProperties()); +var returnValue = true; -switch (executor.inFields.get("testToRun")) { +// Convert Java string to a Javascript variable +var testToRun = String(executor.getInFields().get("testToRun")).valueOf(); + +switch (testToRun) { case "ReadOnly": executor.subject.getTaskKey("ReadOnlyTask").copyTo(executor.selectedTask); break; @@ -50,7 +55,11 @@ switch (executor.inFields.get("testToRun")) { break; default: - executor.subject.getTaskKey("ReadOnlyTask").copyTo(executor.selectedTask); + executor.logger.debug("invalid value for testToRun:" + executor.getInFields().get("testToRun")); + returnValue = false; } -executor.logger.info("Selected Task:" + executor.selectedTask); +executor.logger.debug("Selected Task:" + executor.selectedTask); + +returnValue; + diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js index 3bf129bf8..b60e2acee 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js @@ -18,15 +18,15 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); -executor.logger.info("executionProperties: " + executor.getExecutionProperties()); +executor.logger.debug("executionProperties: " + executor.getExecutionProperties()); if (executor.getExecutionProperties().get("HTTP_CODE_STATUS") == "500") executor.outFields.put("testToRun", "CodeFilterSet"); else executor.outFields.put("testToRun", "CodeFilterDefault"); -executor.logger.info("testToRun: " + executor.outFields.get("testToRun")); +executor.logger.debug("testToRun: " + executor.outFields.get("testToRun")); -var returnValue = executor.isTrue;
\ No newline at end of file +true; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js index b584ec464..d72a002d4 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js @@ -18,13 +18,13 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); -executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties in:" + executor.getExecutionProperties()); executor.getExecutionProperties().setProperty("tagId", executor.inFields.get("testToRun")); executor.getExecutionProperties().setProperty("value", "3"); -executor.logger.info("executionProperties out:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties out:" + executor.getExecutionProperties()); -var returnValue = executor.isTrue;
\ No newline at end of file +true; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js index 9d02b0228..f52590b1e 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js @@ -34,4 +34,4 @@ executor.getExecutionProperties().setProperty("value", closedLoopId); executor.logger.info("executionProperties out: {}", executor.getExecutionProperties().toString()); -var returnValue = executor.isTrue;
\ No newline at end of file +true;
\ No newline at end of file diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js index 814e30217..c5555b99e 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js @@ -33,4 +33,5 @@ if (null == svcId) { executor.getExecutionProperties().setProperty("value", svcId); executor.logger.info("executionProperties out: {}", executor.getExecutionProperties().toString()); -var returnValue = executor.isTrue;
\ No newline at end of file + +true;
\ No newline at end of file |