summaryrefslogtreecommitdiffstats
path: root/examples/examples-adaptive/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'examples/examples-adaptive/src/test')
-rw-r--r--examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTslUseCase.java5
-rw-r--r--examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java7
-rw-r--r--examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTslUseCase.java8
3 files changed, 9 insertions, 11 deletions
diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTslUseCase.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTslUseCase.java
index cb7e3c824..c29a3cb6e 100644
--- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTslUseCase.java
+++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTslUseCase.java
@@ -38,6 +38,7 @@ import org.onap.policy.apex.core.engine.EngineParameters;
import org.onap.policy.apex.core.engine.engine.ApexEngine;
import org.onap.policy.apex.core.engine.engine.impl.ApexEngineFactory;
import org.onap.policy.apex.core.engine.event.EnEvent;
+import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.examples.adaptive.model.AdaptiveDomainModelFactory;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
@@ -148,7 +149,7 @@ public class TestAnomalyDetectionTslUseCase {
assertEquals("ExecutionIDs are different", triggerEvent.getExecutionId(), result.getExecutionId());
triggerEvent.clear();
result.clear();
- Thread.sleep(1);
+ ThreadUtilities.sleep(1);
apexEngine1.stop();
}
@@ -215,7 +216,7 @@ public class TestAnomalyDetectionTslUseCase {
result.clear();
}
apexEngine1.stop();
- Thread.sleep(1000);
+ ThreadUtilities.sleep(1000);
}
/**
diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java
index ec7c197b7..006d3de6f 100644
--- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java
+++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java
@@ -69,11 +69,8 @@ public class TestApexActionListener implements EnEventListener {
*/
@Override
public void onEnEvent(final EnEvent actionEvent) {
- try {
- Thread.sleep(100);
- } catch (final InterruptedException e) {
- e.printStackTrace();
- }
+ ThreadUtilities.sleep(100);
+
if (actionEvent != null) {
System.out.println("Action event from engine:" + actionEvent.getName());
resultEvents.add(actionEvent);
diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTslUseCase.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTslUseCase.java
index 3052c31a7..10d69a457 100644
--- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTslUseCase.java
+++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTslUseCase.java
@@ -38,6 +38,7 @@ import org.onap.policy.apex.core.engine.EngineParameters;
import org.onap.policy.apex.core.engine.engine.ApexEngine;
import org.onap.policy.apex.core.engine.engine.impl.ApexEngineFactory;
import org.onap.policy.apex.core.engine.event.EnEvent;
+import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.examples.adaptive.model.AdaptiveDomainModelFactory;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
@@ -146,7 +147,7 @@ public class TestAutoLearnTslUseCase {
assertEquals("ExecutionIDs are different", triggerEvent.getExecutionId(), result.getExecutionId());
triggerEvent.clear();
result.clear();
- Thread.sleep(1);
+ ThreadUtilities.sleep(10);
apexEngine1.stop();
}
@@ -234,12 +235,11 @@ public class TestAutoLearnTslUseCase {
LOGGER.info("Iteration " + iteration + ": \tpreval\t" + prevval + "\tval\t" + val + "\tavval\t" + avval);
result.clear();
- Thread.sleep(1);
+ ThreadUtilities.sleep(10);
}
apexEngine1.stop();
- Thread.sleep(1000);
-
+ ThreadUtilities.sleep(1000);
}
/**