aboutsummaryrefslogtreecommitdiffstats
path: root/examples/examples-myfirstpolicy/src/test
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 /examples/examples-myfirstpolicy/src/test
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 'examples/examples-myfirstpolicy/src/test')
-rw-r--r--examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpLogicTest.java4
-rw-r--r--examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpModelCliTest.java6
2 files changed, 5 insertions, 5 deletions
diff --git a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpLogicTest.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpLogicTest.java
index f19e2c8c3..3ebf8155e 100644
--- a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpLogicTest.java
+++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpLogicTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,7 +80,6 @@ public class MfpLogicTest {
}
}
-
/**
* Check logic for MyFirstPolicyAlt#1.
*/
@@ -118,8 +118,8 @@ public class MfpLogicTest {
logics.putAll(getTaskLogics(apexPolicyModel));
for (final Entry<String, String> logicvalue : logics.entrySet()) {
- final String filename = "examples/models/MyFirstPolicy/2/" + logicvalue.getKey();
final String logic = logicvalue.getValue();
+ final String filename = "examples/models/MyFirstPolicy/2/" + logicvalue.getKey();
final String expectedlogic = ResourceUtils.getResourceAsString(filename);
assertNotNull("File " + filename + " was not found. It should contain logic for PolicyModel "
+ apexPolicyModel.getKey(), expectedlogic);
diff --git a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpModelCliTest.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpModelCliTest.java
index 07dc96ba3..af0e44450 100644
--- a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpModelCliTest.java
+++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpModelCliTest.java
@@ -94,14 +94,14 @@ public class MfpModelCliTest {
+ tempModelFile1.getAbsolutePath() + " is not the same as the test Model for "
+ testApexModel1.getKey(), testApexModel1, generatedmodel);
+ tempLogFile1.delete();
+ tempModelFile1.delete();
+
generatedmodel = reader.read(TextFileUtils.getTextFileAsString(tempModelFile2.getAbsolutePath()));
assertEquals("Model generated from the CLI (" + testApexModel2CliArgs[1] + ") into file "
+ tempModelFile2.getAbsolutePath() + " is not the same as the test Model for "
+ testApexModel2.getKey(), testApexModel2, generatedmodel);
- tempLogFile1.delete();
- tempModelFile1.delete();
-
tempLogFile2.delete();
tempModelFile2.delete();