From adf67497761295115dc75b525500d687518fc4fd Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 10 Jul 2019 19:44:39 +0000 Subject: Add integration tests for executor properties Added integration test that sets properties in a dummy plugin and amends them in tasks in a policy. Variosu tests added to check combinations of where properties are set in plugins or in tasks or both. Implementaiton changed to: - Always pass in a Properies object, the properties object coming into the policy cannot be null because the task/TSL/SFL may wish to set it - Fix a bug where the properties were not passed from the ApexEvent to the engine event in the ApexEventUnmarshaller class Issue-ID: POLICY-1743 Change-Id: I6aa152b28d46cf3cc6fa56a1a95b76a8e55f5a49 Signed-off-by: liamfallon --- .../logic/DefinedToEmptyTask.js | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js (limited to 'testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js') 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 new file mode 100644 index 000000000..dce37cc3e --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js @@ -0,0 +1,34 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +executor.logger.info(executor.outFields); + +executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); + +var executionProperties = new java.util.Properties(); + +executor.getExecutionProperties().clear(); + +executor.logger.info("executionProperties out:" + executor.getExecutionProperties()); + +var returnValue = executor.isTrue; -- cgit 1.2.3-korg