diff options
author | Jim Hahn <jrh3@att.com> | 2018-06-14 09:05:50 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2018-06-20 15:08:05 -0400 |
commit | 6b8efd3ef507f53b7cd39ad2ba67a8db6fe73cdd (patch) | |
tree | 6e3a0c7b60b5b1cdedff4083e491a2204b15035d /integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java | |
parent | 5c04cdde760ff9f92235f29f8892977853bce864 (diff) |
IntegrityMonitory - remove latch for non-test code
Change-Id: I95ebcf8aabfa01eb6453a4ba5dd88d11c8f025c9
Issue-ID: POLICY-908
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java')
-rw-r--r-- | integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java index 0c8259b7..e5562306 100644 --- a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java +++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java @@ -22,17 +22,14 @@ package org.onap.policy.common.im; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; - import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; -import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; - import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; - import org.onap.policy.common.utils.jpa.EntityTransCloser; import org.onap.policy.common.utils.test.log.logback.ExtractAppender; import org.slf4j.Logger; @@ -243,14 +240,14 @@ public class IntegrityMonitorTestBase { } /** - * Waits for a latch to reach zero. + * Waits for a semaphore to be acquired * - * @param latch the latch + * @param sem the latch * @throws InterruptedException if the thread is interrupted * @throws AssertionError if the latch did not reach zero in the allotted time */ - protected void waitLatch(CountDownLatch latch) throws InterruptedException { - assertTrue(latch.await(WAIT_MS, TimeUnit.SECONDS)); + protected void waitSem(Semaphore sem) throws InterruptedException { + assertTrue(sem.tryAcquire(WAIT_MS, TimeUnit.MILLISECONDS)); } /** |