aboutsummaryrefslogtreecommitdiffstats
path: root/utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java
diff options
context:
space:
mode:
Diffstat (limited to 'utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java')
-rw-r--r--utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java b/utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java
index f52105ed..9e61eaa3 100644
--- a/utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java
+++ b/utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,6 @@ import java.util.PriorityQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import lombok.Getter;
-import org.onap.policy.common.utils.time.TestTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -180,7 +179,7 @@ public class TestTimeMulti extends TestTime {
long realEnd = System.currentTimeMillis() + maxWaitMs;
while (System.currentTimeMillis() < realEnd) {
- if (condition.call()) {
+ if (Boolean.TRUE.equals(condition.call())) {
return;
}
@@ -190,11 +189,13 @@ public class TestTimeMulti extends TestTime {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
logger.error("interrupted while waiting for condition", e);
- fail("interrupted while waiting for condition: " + e.getMessage());
+ // disabling sonar, as this is only used by junit tests
+ fail("interrupted while waiting for condition: " + e.getMessage()); // NOSONAR
} catch (Exception e) {
logger.error("condition evaluator threw an exception", e);
- fail("condition evaluator threw an exception: " + e.getMessage());
+ // disabling sonar, as this is only used by junit tests
+ fail("condition evaluator threw an exception: " + e.getMessage()); // NOSONAR
}
fail(NEVER_SATISFIED);
@@ -281,7 +282,7 @@ public class TestTimeMulti extends TestTime {
return;
}
- SleepItem item = new SleepItem(this, sleepMs, Thread.currentThread());
+ var item = new SleepItem(this, sleepMs, Thread.currentThread());
enqueue(item);
// wait for the item to fire
@@ -299,7 +300,7 @@ public class TestTimeMulti extends TestTime {
logger.info("enqueue work item {}", item);
synchronized (updateLock) {
queue.add(item);
- updateLock.notify();
+ updateLock.notifyAll();
}
}