diff options
Diffstat (limited to 'testsuites/integration/integration-uservice-test')
20 files changed, 105 insertions, 96 deletions
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileIgnore.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileIgnore.java index 6aa73fb07..b9d3bb39b 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileIgnore.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileIgnore.java @@ -51,6 +51,8 @@ public class TestFile2FileIgnore { public static void main(final String[] args) throws MessagingException, ApexException, IOException { final String[] apexArgs = {"-rfr", "target", "-c", "examples/config/SampleDomain/File2FileJsonEvent.json"}; + new File("src/test/resources/events/EventsOut.json").delete(); + testFileEvents(apexArgs, "src/test/resources/events/EventsOut.json", 48656); } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java index 3baa14714..f785ab6f3 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-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. @@ -69,8 +69,8 @@ public class JmsEventProducer implements Runnable { * @throws JMSException the JMS exception */ public JmsEventProducer(final String topic, final ConnectionFactory connectionFactory, final String username, - final String password, final int eventCount, final boolean sendObjects, final long eventInterval) - throws JMSException { + final String password, final int eventCount, final boolean sendObjects, + final long eventInterval) throws JMSException { this.topic = topic; this.eventCount = eventCount; this.sendObjects = sendObjects; @@ -89,7 +89,7 @@ public class JmsEventProducer implements Runnable { public void run() { final Topic jmsTopic = new ActiveMQTopic(topic); try (final Session jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - final MessageProducer jmsProducer = jmsSession.createProducer(jmsTopic)) { + final MessageProducer jmsProducer = jmsSession.createProducer(jmsTopic)) { while (producerThread.isAlive() && !stopFlag) { ThreadUtilities.sleep(50); @@ -128,7 +128,9 @@ public class JmsEventProducer implements Runnable { Message jmsMessage = null; if (sendObjects) { - jmsMessage = jmsSession.createObjectMessage(new PingTestClass()); + final PingTestClass pingTestClass = new PingTestClass(); + pingTestClass.setId(i); + jmsMessage = jmsSession.createObjectMessage(pingTestClass); } else { jmsMessage = jmsSession.createTextMessage(EventGenerator.jsonEvent()); } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java index 5140d71cd..bbbf21c6d 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-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. @@ -63,7 +63,7 @@ public class JmsEventSubscriber implements Runnable { * @throws JMSException the JMS exception */ public JmsEventSubscriber(final String topic, final ConnectionFactory connectionFactory, final String username, - final String password) throws JMSException { + final String password) throws JMSException { this.topic = topic; connection = connectionFactory.createConnection(username, password); connection.start(); @@ -79,7 +79,7 @@ public class JmsEventSubscriber implements Runnable { public void run() { final Topic jmsTopic = new ActiveMQTopic(topic); try (final Session jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - final MessageConsumer jmsConsumer = jmsSession.createConsumer(jmsTopic)) { + final MessageConsumer jmsConsumer = jmsSession.createConsumer(jmsTopic)) { while (subscriberThread.isAlive() && !subscriberThread.isInterrupted()) { try { @@ -95,11 +95,13 @@ public class JmsEventSubscriber implements Runnable { ((TextMessage) message).getText(); } else { throw new ApexEventException("unknowm message \"" + message + "\" of type \"" - + message.getClass().getName() + "\" received"); + + message.getClass().getName() + "\" received"); } eventsReceivedCount++; } catch (final Exception e) { - break; + if (!(e.getCause() instanceof InterruptedException)) { + throw new ApexEventRuntimeException("JMS message reception failed", e); + } } } @@ -107,7 +109,8 @@ public class JmsEventSubscriber implements Runnable { throw new ApexEventRuntimeException("JMS event consumption failed", e); } - LOGGER.debug("{} : event reception completed", this.getClass().getName()); + LOGGER.info("{} : event reception completed, {} events received", this.getClass().getName(), + eventsReceivedCount); } /** @@ -125,6 +128,8 @@ public class JmsEventSubscriber implements Runnable { * @throws JMSException the JMS exception */ public void shutdown() throws JMSException { + LOGGER.info("{} : stopping...", this.getClass().getName()); + subscriberThread.interrupt(); while (subscriberThread.isAlive()) { @@ -132,7 +137,7 @@ public class JmsEventSubscriber implements Runnable { } connection.close(); - LOGGER.debug("{} : stopped", this.getClass().getName()); + LOGGER.info("{} : stopped", this.getClass().getName()); } } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java index 60b9711c9..cc06ea039 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java @@ -21,6 +21,7 @@ package org.onap.policy.apex.testsuites.integration.uservice.adapt.jms; +import static org.awaitility.Awaitility.await; import static org.junit.Assert.assertEquals; import java.io.IOException; @@ -28,6 +29,7 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.concurrent.TimeUnit; import javax.jms.JMSException; @@ -39,9 +41,7 @@ import org.apache.activemq.security.SimpleAuthenticationPlugin; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; -import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.service.engine.main.ApexMain; import org.slf4j.ext.XLogger; @@ -56,7 +56,6 @@ public class TestJms2Jms { public static final String JMS_TOPIC_APEX_IN = "jms/topic/apexIn"; public static final String JMS_TOPIC_APEX_OUT = "jms/topic/apexOut"; - private static final int SLEEP_TIME = 1500; private static final String GROUP_ROLE = "guests"; private static final String PACKAGE_NAME = "org.onap.policy.apex.testsuites.integration.common.testclasses"; private static final String USERNAME = "guest"; @@ -67,7 +66,6 @@ public class TestJms2Jms { private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestJms2Jms.class); - private static final long MAX_TEST_LENGTH = 10000; private static final int EVENT_COUNT = 100; private static final int EVENT_INTERVAL = 20; @@ -143,7 +141,6 @@ public class TestJms2Jms { * @throws JMSException the JMS exception */ @Test - @Ignore public void testJmsObjectEvents() throws ApexException, JMSException { final String[] args = {"-rfr", "target", "-c", "target/examples/config/JMS/JMS2JMSObjectEvent.json"}; testJmsEvents(args, true); @@ -172,38 +169,24 @@ public class TestJms2Jms { private void testJmsEvents(final String[] args, final Boolean sendObjects) throws ApexException, JMSException { final JmsEventSubscriber subscriber = new JmsEventSubscriber(JMS_TOPIC_APEX_OUT, connectionFactory, USERNAME, PASSWORD); + final JmsEventProducer producer = new JmsEventProducer(JMS_TOPIC_APEX_IN, connectionFactory, USERNAME, PASSWORD, EVENT_COUNT, sendObjects, EVENT_INTERVAL); final ApexMain apexMain = new ApexMain(args); - ThreadUtilities.sleep(3000); + + await().atMost(3L, TimeUnit.SECONDS).until(() -> apexMain.isAlive()); producer.sendEvents(); - final long testStartTime = System.currentTimeMillis(); + await().atMost(10L, TimeUnit.SECONDS).until(() -> producer.getEventsSentCount() >= EVENT_COUNT - 1); + await().atMost(10L, TimeUnit.SECONDS).until(() -> subscriber.getEventsReceivedCount() >= EVENT_COUNT - 1); - while (isTimedOut(testStartTime) && subscriber.getEventsReceivedCount() < EVENT_COUNT) { - ThreadUtilities.sleep(EVENT_INTERVAL); - } - - ThreadUtilities.sleep(SLEEP_TIME); apexMain.shutdown(); subscriber.shutdown(); producer.shutdown(); - ThreadUtilities.sleep(SLEEP_TIME); assertEquals(EVENT_COUNT, producer.getEventsSentCount()); assertEquals(producer.getEventsSentCount(), subscriber.getEventsReceivedCount()); - - } - - /** - * Checks if is timed out. - * - * @param testStartTime the test start time - * @return true, if is timed out - */ - private boolean isTimedOut(final long testStartTime) { - return System.currentTimeMillis() < testStartTime + MAX_TEST_LENGTH; } } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngDepMessagingTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngDepMessagingTest.java index d3a6d76d4..09b0143eb 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngDepMessagingTest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngDepMessagingTest.java @@ -1,19 +1,20 @@ /*- * ============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. * 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========================================================= */ @@ -106,7 +107,7 @@ public class EngDepMessagingTest { engineServiceParameters.setInstanceCount(3); engineServiceParameters.setId(100); engineServiceParameters.getEngineParameters().getExecutorParameterMap().put("JAVASCRIPT", - new JavascriptExecutorParameters()); + new JavascriptExecutorParameters()); ParameterService.register(engineServiceParameters, true); ParameterService.register(engineServiceParameters.getEngineParameters(), true); @@ -171,13 +172,13 @@ public class EngDepMessagingTest { eventDataMap.put("TestTimestamp", testStartTime.getTime()); eventDataMap.put("TestTemperature", 34.5445667); - final ApexEvent event0 = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", - "apex", "test"); + final ApexEvent event0 = + new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "apex", "test"); event0.putAll(eventDataMap); server.sendEvent(event0); - final ApexEvent event1 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", - "apex", "test"); + final ApexEvent event1 = + new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "apex", "test"); event1.putAll(eventDataMap); server.sendEvent(event1); @@ -225,5 +226,6 @@ public class EngDepMessagingTest { */ @After public void tearDown() throws Exception { + ModelService.clear(); } } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java index 052f6a2af..7b25da803 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java @@ -50,6 +50,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.handling.ApexModelException; import org.onap.policy.apex.model.basicmodel.handling.ApexModelWriter; +import org.onap.policy.apex.model.basicmodel.service.ModelService; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; import org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters; import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters; @@ -89,13 +90,8 @@ public class ApexServiceTest { private boolean waitFlag = true; - /** - * Sets the up. - * - * @throws Exception the exception - */ @BeforeClass - public static void setUp() throws Exception { + public static void beforeSetUp() throws Exception { // create engine with 3 threads parameters.setInstanceCount(3); parameters.setName(engineServiceKey.getName()); @@ -116,6 +112,11 @@ public class ApexServiceTest { service.registerActionListener("Listener", listener); } + @AfterClass + public static void afterCleardown() throws Exception { + ModelService.clear(); + } + /** * Set up parameters. */ diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/TestExecutionProperties.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/TestExecutionProperties.java index 9327748b8..ec1bd4113 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/TestExecutionProperties.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/TestExecutionProperties.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-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. @@ -110,7 +110,8 @@ public class TestExecutionProperties { File compiledPolicyFile = new File("target/ExecutionPropertiesTestPolicyModel.json"); assertTrue(compiledPolicyFile.exists()); - new File("target/" + testName + "_out.properties").delete(); + File outFile = new File("target/" + testName + "_out.properties"); + outFile.deleteOnExit(); // @formatter:off final String[] args = { @@ -122,9 +123,9 @@ public class TestExecutionProperties { // @formatter:on final ApexMain apexMain = new ApexMain(args); - // TODO: Set back to 10 seconds - await().atMost(10000, TimeUnit.SECONDS) - .until(() -> new File("target/" + testName + "_out.properties").exists()); + await().atMost(1, TimeUnit.SECONDS).until(() -> apexMain.isAlive()); + await().atMost(10, TimeUnit.SECONDS).until(() -> outFile.exists()); + await().atMost(1, TimeUnit.SECONDS).until(() -> outFile.length() > 0); apexMain.shutdown(); @@ -133,7 +134,7 @@ public class TestExecutionProperties { new File("src/test/resources/testdata/executionproperties/" + testName + "_out_expected.properties"))); Properties actualProperties = new Properties(); - actualProperties.load(new FileInputStream(new File("target/" + testName + "_out.properties"))); + actualProperties.load(new FileInputStream(outFile)); assertEquals(expectedProperties, actualProperties); } diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_AvroEventAlbum_EventOutCompare.json b/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_AvroEventAlbum_EventOutCompare.json index 9b3481890..e043ea1e2 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_AvroEventAlbum_EventOutCompare.json +++ b/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_AvroEventAlbum_EventOutCompare.json @@ -15,7 +15,7 @@ "AvroBoolean": true, "AvroByte": -127.0, "AvroDouble": 1.2345E67, - "AvroFloat": 1.9999999556392617E23, + "AvroFloat": 1.9999999999999998E23, "AvroInteger": 1234568.0, "AvroLong": 1.234567890124E12, "AvroMap": { diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/events/EventsOut.json b/testsuites/integration/integration-uservice-test/src/test/resources/events/EventsOut.json deleted file mode 100644 index e69de29bb..000000000 --- a/testsuites/integration/integration-uservice-test/src/test/resources/events/EventsOut.json +++ /dev/null diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js index 54826ce7a..b3176b3ed 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); -executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties in:" + executor.getExecutionProperties()); var executionProperties = new java.util.Properties(); executor.getExecutionProperties().setProperty("goodbye", "mars"); -executor.logger.info("executionProperties out:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties out:" + executor.getExecutionProperties()); -var returnValue = executor.isTrue; +true; 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 index 4596dd4b4..90d522575 100644 --- 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 @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); -executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties in:" + executor.getExecutionProperties()); var executionProperties = new java.util.Properties(); executor.getExecutionProperties().clear(); -executor.logger.info("executionProperties out:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties out:" + executor.getExecutionProperties()); -var returnValue = executor.isTrue; +true; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js index ba807cf73..bdfd806bd 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); -executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties in:" + executor.getExecutionProperties()); var executionProperties = new java.util.Properties(); executor.getExecutionProperties().setProperty("hello", "world"); -executor.logger.info("executionProperties out:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties out:" + executor.getExecutionProperties()); -var returnValue = executor.isTrue; +true; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js index 6cae0ceb1..3ade84846 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js @@ -18,8 +18,9 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); +executor.logger.debug(executor.getInFields().toString()); +executor.logger.debug("executionProperties:" + executor.getExecutionProperties()); +executor.logger.debug(executor.getOutFields().toString()); -executor.logger.info("executionProperties:" + executor.getExecutionProperties()); - -var returnValue = executor.isTrue; +true; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js index 6cae0ceb1..a5806cd72 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js @@ -18,8 +18,10 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); +executor.logger.debug(executor.getInFields().toString()); +executor.logger.debug("executionProperties:" + executor.getExecutionProperties()); -executor.logger.info("executionProperties:" + executor.getExecutionProperties()); +executor.logger.debug(executor.getOutFields().toString()); -var returnValue = executor.isTrue; +true; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js index 2d934636a..12ec9aee1 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); -executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties in:" + executor.getExecutionProperties()); var executionProperties = new java.util.Properties(); executor.getExecutionProperties().remove("hello"); -executor.logger.info("executionProperties out:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties out:" + executor.getExecutionProperties()); -var returnValue = executor.isTrue; +true; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js index f41c7c02a..86838fe7c 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js @@ -18,13 +18,18 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); +executor.logger.debug(executor.getInFields().toString()); +executor.logger.debug("executionProperties:" + executor.getExecutionProperties()); -var returnValue = executor.isTrue; +executor.logger.debug("testToRun:" + executor.getInFields().get("testToRun")); -executor.logger.info("executionProperties:" + executor.getExecutionProperties()); +var returnValue = true; -switch (executor.inFields.get("testToRun")) { +// Convert Java string to a Javascript variable +var testToRun = String(executor.getInFields().get("testToRun")).valueOf(); + +switch (testToRun) { case "ReadOnly": executor.subject.getTaskKey("ReadOnlyTask").copyTo(executor.selectedTask); break; @@ -50,7 +55,11 @@ switch (executor.inFields.get("testToRun")) { break; default: - executor.subject.getTaskKey("ReadOnlyTask").copyTo(executor.selectedTask); + executor.logger.debug("invalid value for testToRun:" + executor.getInFields().get("testToRun")); + returnValue = false; } -executor.logger.info("Selected Task:" + executor.selectedTask); +executor.logger.debug("Selected Task:" + executor.selectedTask); + +returnValue; + diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js index 3bf129bf8..b60e2acee 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js @@ -18,15 +18,15 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); -executor.logger.info("executionProperties: " + executor.getExecutionProperties()); +executor.logger.debug("executionProperties: " + executor.getExecutionProperties()); if (executor.getExecutionProperties().get("HTTP_CODE_STATUS") == "500") executor.outFields.put("testToRun", "CodeFilterSet"); else executor.outFields.put("testToRun", "CodeFilterDefault"); -executor.logger.info("testToRun: " + executor.outFields.get("testToRun")); +executor.logger.debug("testToRun: " + executor.outFields.get("testToRun")); -var returnValue = executor.isTrue;
\ No newline at end of file +true; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js index b584ec464..d72a002d4 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js @@ -18,13 +18,13 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.getSubject().getId()); +executor.logger.debug(executor.getSubject().getId()); -executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties in:" + executor.getExecutionProperties()); executor.getExecutionProperties().setProperty("tagId", executor.inFields.get("testToRun")); executor.getExecutionProperties().setProperty("value", "3"); -executor.logger.info("executionProperties out:" + executor.getExecutionProperties()); +executor.logger.debug("executionProperties out:" + executor.getExecutionProperties()); -var returnValue = executor.isTrue;
\ No newline at end of file +true; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js index 9d02b0228..f52590b1e 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js @@ -34,4 +34,4 @@ executor.getExecutionProperties().setProperty("value", closedLoopId); executor.logger.info("executionProperties out: {}", executor.getExecutionProperties().toString()); -var returnValue = executor.isTrue;
\ No newline at end of file +true;
\ No newline at end of file diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js index 814e30217..c5555b99e 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js @@ -33,4 +33,5 @@ if (null == svcId) { executor.getExecutionProperties().setProperty("value", svcId); executor.logger.info("executionProperties out: {}", executor.getExecutionProperties().toString()); -var returnValue = executor.isTrue;
\ No newline at end of file + +true;
\ No newline at end of file |