diff options
Diffstat (limited to 'plugins/plugins-executor/plugins-executor-javascript')
2 files changed, 6 insertions, 5 deletions
diff --git a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptExecutor.java b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptExecutor.java index 344f8c5ae..18aac64cf 100644 --- a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptExecutor.java +++ b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptExecutor.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,7 +68,7 @@ public class JavascriptExecutor { public boolean execute(final Object executionContext) throws StateMachineException { Object returnObject = null; - Context context = Context.enter(); + var context = Context.enter(); try { // Pass the subject context to the Javascript engine Scriptable javascriptScope = context.initStandardObjects(); @@ -91,7 +92,7 @@ public class JavascriptExecutor { } private Script compile(String id, String javascriptCode) throws StateMachineException { - Context context = Context.enter(); + var context = Context.enter(); try { // Set up the default values of the context context.setOptimizationLevel(DEFAULT_OPTIMIZATION_LEVEL); diff --git a/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutorTest.java b/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutorTest.java index 78ac85366..d2bb852b6 100644 --- a/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutorTest.java +++ b/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutorTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,9 +86,8 @@ public class JavascriptTaskSelectExecutorTest { state.getTaskSelectionLogic().setLogic("java.lang.String"); jtse.prepare(); - assertThatThrownBy(() -> { - jtse.execute(-1, new Properties(), null); - }).isInstanceOf(NullPointerException.class); + final var props = new Properties(); + assertThatThrownBy(() -> jtse.execute(-1, props, null)).isInstanceOf(NullPointerException.class); AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1")); EnEvent event = new EnEvent(axEvent); |