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 /auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex | |
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 'auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex')
-rw-r--r-- | auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex b/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex index 2a36c4fa1..2cc957efc 100644 --- a/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex +++ b/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex @@ -228,9 +228,9 @@ var customDate2 = executor.getContextAlbum("CustomDate2Album" ).get("CustomDa var customSet = executor.getContextAlbum("CustomSetAlbum" ).get("CustomSet" ); var customMap = executor.getContextAlbum("CustomMapAlbum" ).get("CustomMap" ); -javaBoolean = !javaBoolean; +javaBoolean = javaBoolean == false; javaByte += 1; -javaShortType = Java.type("java.lang.Short"); +javaShortType = java.lang.Short; javaShort = new javaShortType(javaShort + 1); javaInteger += 1; javaLong += 1; @@ -246,14 +246,14 @@ customDouble .setDoubleValue(customDouble .getIncrementedDoubleValue()); customString .setStringValue(customString .getStringValue() + " added to end of string"); customJLong .setLongValue (customJLong .getIncrementedLongValue()); -customDate0Type = Java.type("org.onap.policy.apex.context.test.concepts.TestContextDateItem"); +customDate0Type = org.onap.policy.apex.context.test.concepts.TestContextDateItem; customDate0 = new customDate0Type(1499868391); -customDate1Type = Java.type("org.onap.policy.apex.context.test.concepts.TestContextDateTzItem"); +customDate1Type = org.onap.policy.apex.context.test.concepts.TestContextDateTzItem; customDate1 = new customDate1Type(); customDate1.setDateValue(customDate0); -customDate2Type = Java.type("org.onap.policy.apex.context.test.concepts.TestContextDateLocaleItem"); +customDate2Type = org.onap.policy.apex.context.test.concepts.TestContextDateLocaleItem; customDate2 = new customDate2Type(); customDate2.setDateValue(customDate0); @@ -309,9 +309,8 @@ executor.outFields.put("CustomDate2" , executor.getContextAlbum("CustomDate2Alb executor.outFields.put("CustomSet" , executor.getContextAlbum("CustomSetAlbum" ).get("CustomSet" )); executor.outFields.put("CustomMap" , executor.getContextAlbum("CustomMapAlbum" ).get("CustomMap" )); -var returnValueType = Java.type("java.lang.Boolean"); -var returnValue = new returnValueType(true); - +var returnValue = true; +returnValue; LE policy create name=Test_Policy template=FREEFORM firstState=OnlyState |