From 1b43df37f166ce758ad22cef567fe120ad853705 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Fri, 28 Feb 2020 16:54:48 +0000 Subject: Switch apex to Graal javascript engine 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 --- .../event/carrier/restrequestor/ApexRestRequestorProducer.java | 9 +++------ .../src/test/resources/policymodels/RequestorModel.json | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'plugins/plugins-event') diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java index 3e2cd5a94..e166bdc1f 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java @@ -21,16 +21,13 @@ package org.onap.policy.apex.plugins.event.carrier.restrequestor; -import java.util.EnumMap; -import java.util.Map; import java.util.Properties; import org.onap.policy.apex.service.engine.event.ApexEventConsumer; import org.onap.policy.apex.service.engine.event.ApexEventException; -import org.onap.policy.apex.service.engine.event.ApexPluginsEventProducer; import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException; +import org.onap.policy.apex.service.engine.event.ApexPluginsEventProducer; import org.onap.policy.apex.service.engine.event.PeeredReference; -import org.onap.policy.apex.service.engine.event.SynchronousEventCache; import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters; import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode; import org.slf4j.Logger; @@ -125,8 +122,8 @@ public class ApexRestRequestorProducer extends ApexPluginsEventProducer { // Use the consumer to handle this event final ApexRestRequestorConsumer restRequstConsumer = (ApexRestRequestorConsumer) consumer; - restRequstConsumer.processRestRequest(new ApexRestRequest( - executionId, executionProperties, eventName, event)); + restRequstConsumer + .processRestRequest(new ApexRestRequest(executionId, executionProperties, eventName, event)); eventsSent++; } else { diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/resources/policymodels/RequestorModel.json b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/resources/policymodels/RequestorModel.json index b6fdc617b..98510d2a5 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/resources/policymodels/RequestorModel.json +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/resources/policymodels/RequestorModel.json @@ -460,7 +460,7 @@ "taskLogic" : { "key" : "TaskLogic", "logicFlavour" : "JAVASCRIPT", - "logic" : "executor.logger.debug(executor.subject.id);\nvar gc = executor.getContextAlbum(\"BasicContextAlbum\");\nexecutor.logger.debug(gc.name);\nexecutor.logger.debug(executor.inFields);\n\nexecutor.logger.debug(executor.eo);\n\nvar returnValue = executor.isTrue;" + "logic" : "executor.logger.debug(executor.subject.getId());\nvar gc = executor.getContextAlbum(\"BasicContextAlbum\");\nexecutor.logger.debug(gc.getName());\nvar returnValue = executor.isTrue;" } } } ] -- cgit 1.2.3-korg