summaryrefslogtreecommitdiffstats
path: root/testsuites
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 /testsuites
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 'testsuites')
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java39
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/testclasses/PingTestClass.java97
-rw-r--r--testsuites/integration/integration-common/src/main/resources/examples/models/JMS/JMSTestModel.json2
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript13
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript17
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript11
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript14
-rw-r--r--testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/testclasses/TestPingClassTest.java19
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java5
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJRuby.java17
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.java17
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.java17
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java3
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.java9
-rw-r--r--testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml50
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileIgnore.java2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java12
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java19
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java31
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngDepMessagingTest.java18
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java13
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/TestExecutionProperties.java13
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/events/Context_AvroEventAlbum_EventOutCompare.json2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/events/EventsOut.json0
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js8
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js8
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js8
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js9
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js8
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js8
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js21
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js8
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js8
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js3
-rw-r--r--testsuites/integration/pom.xml4
36 files changed, 212 insertions, 323 deletions
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java
index c1c656490..3730bba47 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java
@@ -21,8 +21,7 @@
package org.onap.policy.apex.testsuites.integration.common.model.java;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
+import java.util.Random;
import org.onap.policy.apex.core.engine.executor.context.TaskExecutionContext;
@@ -36,7 +35,7 @@ public class DefaultTaskLogic {
* Gets the event.
*
* @param executor the executor
- * @return true , if the event exists
+ * @return the event
*/
public boolean getEvent(final TaskExecutionContext executor) {
String idString = executor.subject.getId();
@@ -47,26 +46,20 @@ public class DefaultTaskLogic {
String inFieldsString = executor.inFields.toString();
executor.logger.debug(inFieldsString);
-
- try {
- SecureRandom rand = SecureRandom.getInstanceStrong();
- if (executor.inFields.containsKey("TestDecideCaseSelected")) {
- executor.outFields.put("TestActCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
- executor.outFields.put("TestActStateTime", System.nanoTime());
- } else if (executor.inFields.containsKey("TestEstablishCaseSelected")) {
- executor.outFields.put("TestDecideCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
- executor.outFields.put("TestDecideStateTime", System.nanoTime());
- } else if (executor.inFields.containsKey("TestMatchCaseSelected")) {
- executor.outFields.put("TestEstablishCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
- executor.outFields.put("TestEstablishStateTime", System.nanoTime());
- } else {
- executor.outFields.put("TestMatchCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
- executor.outFields.put("TestMatchStateTime", System.nanoTime());
- }
- } catch (NoSuchAlgorithmException e) {
- executor.logger.error("Exception during Random number generation ", e);
- return false;
+ final Random rand = new Random();
+ if (executor.inFields.containsKey("TestDecideCaseSelected")) {
+ executor.outFields.put("TestActCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
+ executor.outFields.put("TestActStateTime", System.nanoTime());
+ } else if (executor.inFields.containsKey("TestEstablishCaseSelected")) {
+ executor.outFields.put("TestDecideCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
+ executor.outFields.put("TestDecideStateTime", System.nanoTime());
+ } else if (executor.inFields.containsKey("TestMatchCaseSelected")) {
+ executor.outFields.put("TestEstablishCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
+ executor.outFields.put("TestEstablishStateTime", System.nanoTime());
+ } else {
+ executor.outFields.put("TestMatchCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
+ executor.outFields.put("TestMatchStateTime", System.nanoTime());
}
- return true;
+ return true;
}
}
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/testclasses/PingTestClass.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/testclasses/PingTestClass.java
index b64f76b93..1ed5d20f5 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/testclasses/PingTestClass.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/testclasses/PingTestClass.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=========================================================
*/
@@ -22,6 +23,8 @@ package org.onap.policy.apex.testsuites.integration.common.testclasses;
import java.io.Serializable;
+import lombok.Data;
+
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
/**
@@ -29,96 +32,17 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@Data
public class PingTestClass implements Serializable {
private static final long serialVersionUID = -3400711508992955886L;
+ private int id = 0;
private String name = "Rose";
private String description = "A rose by any other name would smell as sweet";
private long pingTime = System.currentTimeMillis();
private long pongTime = -1;
/**
- * Gets the name.
- *
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the name.
- *
- * @param name the new name
- */
- public void setName(final String name) {
- this.name = name;
- }
-
- /**
- * Gets the description.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description the new description
- */
- public void setDescription(final String description) {
- this.description = description;
- }
-
- /**
- * Gets the ping time.
- *
- * @return the ping time
- */
- public long getPingTime() {
- return pingTime;
- }
-
- /**
- * Sets the ping time.
- *
- * @param pingTime the new ping time
- */
- public void setPingTime(final long pingTime) {
- this.pingTime = pingTime;
- }
-
- /**
- * Gets the pong time.
- *
- * @return the pong time
- */
- public long getPongTime() {
- return pongTime;
- }
-
- /**
- * Sets the pong time.
- *
- * @param pongTime the new pong time
- */
- public void setPongTime(final long pongTime) {
- this.pongTime = pongTime;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String toString() {
- return "TestPing [name=" + name + ", description=" + description + ", pingTime=" + pingTime + ", pongTime="
- + pongTime + "]";
- }
-
- /**
* Verify the class.
*
* @throws ApexException the apex event exception
@@ -140,8 +64,9 @@ public class PingTestClass implements Serializable {
throw new ApexException("TestPing is not valid, description is incorrect");
}
- if (pongTime <= pingTime) {
- throw new ApexException("TestPing is not valid, pong time is not greater than ping time");
+ if (pongTime < pingTime) {
+ throw new ApexException(
+ "TestPing is not valid, pong time " + pongTime + " is less than ping time " + pingTime);
}
}
}
diff --git a/testsuites/integration/integration-common/src/main/resources/examples/models/JMS/JMSTestModel.json b/testsuites/integration/integration-common/src/main/resources/examples/models/JMS/JMSTestModel.json
index 78c8110b9..67fdcbfe5 100644
--- a/testsuites/integration/integration-common/src/main/resources/examples/models/JMS/JMSTestModel.json
+++ b/testsuites/integration/integration-common/src/main/resources/examples/models/JMS/JMSTestModel.json
@@ -342,7 +342,7 @@
"taskLogic": {
"key": "TaskLogic",
"logicFlavour": "JAVASCRIPT",
- "logic": "var outFieldType = Java.type(\"org.onap.policy.apex.testsuites.integration.common.testclasses.PingTestClass\");\nvar outValue = new outFieldType();\n\nvar inValue = executor.inFields.get(\"PingTestClass\");\n\nexecutor.logger.info(inValue.toString());\n\noutValue.setPingTime(inValue.getPingTime());\noutValue.setPongTime(new Date().getTime());\noutValue.setName(inValue.getName() + \"_out\");\n\noutValue.setDescription(\ninValue.getDescription() +\n\". So Romeo would, were he not Romeo call'd,\" +\n\" retain that dear perfection which he owes, without that title.\");\n\nexecutor.logger.info(outValue.toString();\nexecutor.outFields.put(\"PingTestClass\", outValue)\n\nvar returnValueType = Java.type(\"java.lang.Boolean\");\nvar returnValue = new returnValueType(true);"
+ "logic": "var outFieldType = org.onap.policy.apex.testsuites.integration.common.testclasses.PingTestClass;\nvar outValue = new outFieldType();\n\nvar inValue = executor.inFields.get(\"PingTestClass\");\n\nexecutor.logger.debug(inValue.toString());\n\noutValue.setPingTime(inValue.getPingTime());\noutValue.setPongTime(new Date().getTime());\noutValue.setName(inValue.getName() + \"_out\");\n\noutValue.setDescription(\ninValue.getDescription() +\n\". So Romeo would, were he not Romeo call'd,\" +\n\" retain that dear perfection which he owes, without that title.\");\n\nexecutor.logger.debug(outValue.toString());\nexecutor.outFields.put(\"PingTestClass\", outValue)\n\ntrue;"
}
}
}
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript
index a3f1525d0..6d94ab1ab 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript
@@ -6,23 +6,22 @@
* 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.debug(executor.subject.getId());
+executor.logger.debug(executor.getSubject().getId());
var gc = executor.getContextAlbum("GlobalContextAlbum");
executor.logger.debug(gc.getName());
-executor.getSubject().getDefaultTaskKey().copyTo(executor.selectedTask);
-
-var returnValue = executor.isTrue;
+executor.getSubject().getDefaultTaskKey().copyTo(executor.selectedTask)
+true; \ No newline at end of file
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript
index 36fd2c4a2..563572057 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript
@@ -6,28 +6,29 @@
* 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.debug(executor.subject.getId());
+executor.logger.debug(executor.getSubject().getId());
+executor.logger.debug(executor.getInFields());
+
var gc = executor.getContextAlbum("GlobalContextAlbum");
executor.logger.debug(gc.getName());
-executor.logger.debug(executor.inFields.get("TestSlogan"));
-var caseSelectedType = Java.type("java.lang.Byte");
+var caseSelectedType = java.lang.Byte;
executor.outFields.put("Test<STATE_NAME>CaseSelected", new caseSelectedType(<RANDOM_BYTE_VALUE>));
executor.outFields.put("Test<STATE_NAME>StateTime", java.lang.System.nanoTime());
-executor.logger.debug(executor.inFields.get("TestSlogan"));
+executor.logger.debug(executor.getOutFields());
-var returnValue = executor.isTrue;
+true;
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript
index 5ee2a0448..4fcfda1c1 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript
@@ -6,21 +6,20 @@
* 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.debug(executor.subject.getId());
+executor.logger.debug(executor.getSubject().getId());
executor.subject.defaultTaskKey.copyTo(executor.selectedTask);
-var returnValue = executor.isTrue;
-
+true;
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript
index b29e96fcf..17d3d8a93 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript
@@ -6,23 +6,23 @@
* 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.debug(executor.subject.getId());
-executor.logger.debug(executor.inFields.get("name"));
+executor.logger.debug(executor.getSubject().getId());
+executor.logger.debug(executor.getInFields());
executor.outFields.put("State<STATE_NUMBER>Timestamp", java.lang.System.nanoTime());
-executor.logger.debug(executor.outFields.get("name"));
+executor.logger.debug(executor.getOutFields());
-var returnValue = executor.isTrue;
+true; \ No newline at end of file
diff --git a/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/testclasses/TestPingClassTest.java b/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/testclasses/TestPingClassTest.java
index 6ca7ed9d7..82f46c04a 100644
--- a/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/testclasses/TestPingClassTest.java
+++ b/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/testclasses/TestPingClassTest.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 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,15 +107,15 @@ public class TestPingClassTest {
ptc.verify();
fail("test should throw an exception");
} catch (ApexException ae) {
- assertEquals("TestPing is not valid, pong time is not greater than ping time", ae.getMessage());
+ assertEquals("TestPing is not valid, pong time -1 is less than ping time 0", ae.getMessage());
}
- ptc.setPongTime(0);
+ ptc.setPongTime(-2);
try {
ptc.verify();
fail("test should throw an exception");
} catch (ApexException ae) {
- assertEquals("TestPing is not valid, pong time is not greater than ping time", ae.getMessage());
+ assertEquals("TestPing is not valid, pong time -2 is less than ping time 0", ae.getMessage());
}
ptc.setPongTime(1);
@@ -124,7 +125,9 @@ public class TestPingClassTest {
fail("test should not throw an exception");
}
- assertEquals("TestPing [name=Rose, description=A rose by any other name would smell as sweet, "
- + "pingTime=0, pongTime=1]", ptc.toString());
+ assertEquals(
+ "PingTestClass(id=0, name=Rose, "
+ + "description=A rose by any other name would smell as sweet, pingTime=0, pongTime=1)",
+ ptc.toString());
}
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java
index 01107e968..b3e68b2be 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java
@@ -21,6 +21,7 @@
package org.onap.policy.apex.testsuites.integration.executor.engine;
+import static org.awaitility.Awaitility.await;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -29,6 +30,7 @@ import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
import org.onap.policy.apex.core.engine.EngineParameters;
import org.onap.policy.apex.core.engine.engine.ApexEngine;
@@ -36,6 +38,7 @@ import org.onap.policy.apex.core.engine.engine.impl.ApexEngineFactory;
import org.onap.policy.apex.core.engine.event.EnEvent;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.enginemodel.concepts.AxEngineState;
import org.onap.policy.apex.model.eventmodel.concepts.AxEvent;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
import org.onap.policy.apex.testsuites.integration.common.model.SampleDomainModelFactory;
@@ -93,6 +96,8 @@ public class TestApexEngine {
final Map<AxArtifactKey, Map<String, Object>> apexContext = apexEngine.getEngineContext();
assertNotNull(apexContext);
apexEngine.stop();
+
+ await().atMost(3L, TimeUnit.SECONDS).until(() -> AxEngineState.STOPPED.equals(apexEngine.getState()));
}
/**
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJRuby.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJRuby.java
index 108e73ac1..f344add45 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJRuby.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJRuby.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=========================================================
*/
@@ -30,7 +31,6 @@ import org.onap.policy.apex.context.parameters.ContextParameterConstants;
import org.onap.policy.apex.context.parameters.ContextParameters;
import org.onap.policy.apex.context.parameters.SchemaParameters;
import org.onap.policy.apex.core.engine.EngineParameters;
-import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.plugins.executor.jruby.JrubyExecutorParameters;
import org.onap.policy.common.parameters.ParameterService;
@@ -49,12 +49,12 @@ public class TestApexEngineJRuby {
@Before
public void beforeTest() {
schemaParameters = new SchemaParameters();
-
+
schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
ParameterService.register(schemaParameters);
-
+
contextParameters = new ContextParameters();
contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
@@ -66,7 +66,7 @@ public class TestApexEngineJRuby {
ParameterService.register(contextParameters.getDistributorParameters());
ParameterService.register(contextParameters.getLockManagerParameters());
ParameterService.register(contextParameters.getPersistorParameters());
-
+
engineParameters = new EngineParameters();
engineParameters.getExecutorParameterMap().put("JRUBY", new JrubyExecutorParameters());
ParameterService.register(engineParameters);
@@ -78,7 +78,7 @@ public class TestApexEngineJRuby {
@After
public void afterTest() {
ParameterService.deregister(engineParameters);
-
+
ParameterService.deregister(contextParameters.getDistributorParameters());
ParameterService.deregister(contextParameters.getLockManagerParameters());
ParameterService.deregister(contextParameters.getPersistorParameters());
@@ -97,7 +97,6 @@ public class TestApexEngineJRuby {
@Test
public void testApexEngineJRuby() throws ApexException, InterruptedException, IOException {
new TestApexEngine("JRUBY", engineParameters);
- ThreadUtilities.sleep(5000);
new TestApexEngine("JRUBY", engineParameters);
}
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.java
index bfdd08255..48bb897e4 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.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=========================================================
*/
@@ -30,7 +31,6 @@ import org.onap.policy.apex.context.parameters.ContextParameterConstants;
import org.onap.policy.apex.context.parameters.ContextParameters;
import org.onap.policy.apex.context.parameters.SchemaParameters;
import org.onap.policy.apex.core.engine.EngineParameters;
-import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.plugins.executor.java.JavaExecutorParameters;
import org.onap.policy.common.parameters.ParameterService;
@@ -51,12 +51,12 @@ public class TestApexEngineJava {
@Before
public void beforeTest() {
schemaParameters = new SchemaParameters();
-
+
schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
ParameterService.register(schemaParameters);
-
+
contextParameters = new ContextParameters();
contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
@@ -68,7 +68,7 @@ public class TestApexEngineJava {
ParameterService.register(contextParameters.getDistributorParameters());
ParameterService.register(contextParameters.getLockManagerParameters());
ParameterService.register(contextParameters.getPersistorParameters());
-
+
engineParameters = new EngineParameters();
engineParameters.getExecutorParameterMap().put("JAVA", new JavaExecutorParameters());
ParameterService.register(engineParameters);
@@ -80,7 +80,7 @@ public class TestApexEngineJava {
@After
public void afterTest() {
ParameterService.deregister(engineParameters);
-
+
ParameterService.deregister(contextParameters.getDistributorParameters());
ParameterService.deregister(contextParameters.getLockManagerParameters());
ParameterService.deregister(contextParameters.getPersistorParameters());
@@ -99,7 +99,6 @@ public class TestApexEngineJava {
@Test
public void testApexEngineJava() throws InterruptedException, IOException, ApexException {
new TestApexEngine("JAVA", engineParameters);
- ThreadUtilities.sleep(5000);
new TestApexEngine("JAVA", engineParameters);
}
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.java
index 05068fcb0..4ace53f31 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.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=========================================================
*/
@@ -30,7 +31,6 @@ import org.onap.policy.apex.context.parameters.ContextParameterConstants;
import org.onap.policy.apex.context.parameters.ContextParameters;
import org.onap.policy.apex.context.parameters.SchemaParameters;
import org.onap.policy.apex.core.engine.EngineParameters;
-import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters;
import org.onap.policy.common.parameters.ParameterService;
@@ -49,12 +49,12 @@ public class TestApexEngineJavascript {
@Before
public void beforeTest() {
schemaParameters = new SchemaParameters();
-
+
schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
ParameterService.register(schemaParameters);
-
+
contextParameters = new ContextParameters();
contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
@@ -66,7 +66,7 @@ public class TestApexEngineJavascript {
ParameterService.register(contextParameters.getDistributorParameters());
ParameterService.register(contextParameters.getLockManagerParameters());
ParameterService.register(contextParameters.getPersistorParameters());
-
+
engineParameters = new EngineParameters();
engineParameters.getExecutorParameterMap().put("JAVASCRIPT", new JavascriptExecutorParameters());
ParameterService.register(engineParameters);
@@ -78,7 +78,7 @@ public class TestApexEngineJavascript {
@After
public void afterTest() {
ParameterService.deregister(engineParameters);
-
+
ParameterService.deregister(contextParameters.getDistributorParameters());
ParameterService.deregister(contextParameters.getLockManagerParameters());
ParameterService.deregister(contextParameters.getPersistorParameters());
@@ -98,7 +98,6 @@ public class TestApexEngineJavascript {
public void testApexEngineJavascript() throws ApexException, InterruptedException, IOException {
new TestApexEngine("JAVASCRIPT", engineParameters);
- ThreadUtilities.sleep(5000);
new TestApexEngine("JAVASCRIPT", engineParameters);
}
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java
index 088d04fd7..a394e5bca 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.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.
@@ -30,7 +31,6 @@ import org.onap.policy.apex.context.parameters.ContextParameterConstants;
import org.onap.policy.apex.context.parameters.ContextParameters;
import org.onap.policy.apex.context.parameters.SchemaParameters;
import org.onap.policy.apex.core.engine.EngineParameters;
-import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters;
import org.onap.policy.common.parameters.ParameterService;
@@ -100,7 +100,6 @@ public class TestApexEngineJython {
@Test
public void testApexEngineJython() throws ApexException, InterruptedException, IOException {
new TestApexEngine("JAVASCRIPT", engineParameters);
- ThreadUtilities.sleep(5000);
new TestApexEngine("JAVASCRIPT", engineParameters);
}
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.java
index 7b4d05a5f..9b4d15ef5 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.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=========================================================
*/
@@ -30,7 +31,6 @@ import org.onap.policy.apex.context.parameters.ContextParameterConstants;
import org.onap.policy.apex.context.parameters.ContextParameters;
import org.onap.policy.apex.context.parameters.SchemaParameters;
import org.onap.policy.apex.core.engine.EngineParameters;
-import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters;
import org.onap.policy.common.parameters.ParameterService;
@@ -97,7 +97,6 @@ public class TestApexEngineMvel {
@Test
public void testApexEngineMvel() throws ApexException, InterruptedException, IOException {
new TestApexEngine("MVEL", engineParameters);
- ThreadUtilities.sleep(5000);
new TestApexEngine("MVEL", engineParameters);
}
}
diff --git a/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml b/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml
index 006555e78..755608346 100644
--- a/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml
+++ b/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml
@@ -2,28 +2,27 @@
<!--
============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=========================================================
-->
<configuration>
-
<contextName>Apex</contextName>
<statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
- <property name="LOG_DIR" value="${java.io.tmpdir}/apex_logging/" />
<!-- USE FOR STD OUT ONLY -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
@@ -32,47 +31,8 @@
</encoder>
</appender>
- <root level="INFO">
+ <root level="OFF">
<appender-ref ref="STDOUT" />
</root>
- <logger name="org.infinispan" level="INFO" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="org.apache.zookeeper.ClientCnxn" level="OFF" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <file>${LOG_DIR}/apex.log</file>
- <encoder>
- <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
- %logger{26} - %msg %n %ex{full}</pattern>
- </encoder>
- </appender>
-
- <appender name="CTXT_FILE" class="ch.qos.logback.core.FileAppender">
- <file>${LOG_DIR}/apex_ctxt.log</file>
- <encoder>
- <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
- %logger{26} - %msg %n %ex{full}</pattern>
- </encoder>
- </appender>
-
- <logger name="org.onap.policy.apex.core.context.monitoring" level="INFO" additivity="false">
- <appender-ref ref="CTXT_FILE" />
- </logger>
-
- <logger name="org.onap.policy.apex.core.engine.monitoring" level="INFO" additivity="false">
- <appender-ref ref="CTXT_FILE" />
- </logger>
-
- <logger name="org.onap.policy.apex.executionlogging" level="INFO" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="org.onap.policy.apex" level="INFO" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
</configuration>
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
diff --git a/testsuites/integration/pom.xml b/testsuites/integration/pom.xml
index 885ac72ee..f9caabbc1 100644
--- a/testsuites/integration/pom.xml
+++ b/testsuites/integration/pom.xml
@@ -34,8 +34,8 @@
<modules>
<module>integration-common</module>
- <!--module>integration-executor-test</module-->
- <!--module>integration-uservice-test</module-->
+ <module>integration-executor-test</module>
+ <module>integration-uservice-test</module>
</modules>
<dependencies>