|
63 | 63 | import java.util.concurrent.ConcurrentMap;
|
64 | 64 | import java.util.concurrent.CountDownLatch;
|
65 | 65 | import java.util.concurrent.TimeUnit;
|
| 66 | +import java.util.concurrent.TimeoutException; |
66 | 67 | import java.util.concurrent.atomic.AtomicInteger;
|
67 | 68 | import java.util.function.Supplier;
|
68 | 69 | import javax.xml.parsers.DocumentBuilderFactory;
|
@@ -2961,17 +2962,15 @@ protected ResourceTrackerService createResourceTrackerService() {
|
2961 | 2962 | }
|
2962 | 2963 |
|
2963 | 2964 | private void pollingAssert(Supplier<Boolean> supplier, String message)
|
2964 |
| - throws InterruptedException { |
2965 |
| - pollingAssert(supplier, true, message); |
| 2965 | + throws InterruptedException, TimeoutException { |
| 2966 | + GenericTestUtils.waitFor(supplier, |
| 2967 | + 100, 10_000, message); |
2966 | 2968 | }
|
2967 | 2969 |
|
2968 | 2970 | private <T> void pollingAssert(Supplier<T> supplier, T expected, String message)
|
2969 |
| - throws InterruptedException { |
2970 |
| - long timeOut = System.currentTimeMillis() + 10_000; |
2971 |
| - while (System.currentTimeMillis() < timeOut && !Objects.equals(expected, supplier.get())) { |
2972 |
| - Thread.sleep(100); |
2973 |
| - } |
2974 |
| - Assert.assertEquals(message, expected, supplier.get()); |
| 2971 | + throws InterruptedException, TimeoutException { |
| 2972 | + GenericTestUtils.waitFor(() -> Objects.equals(supplier.get(), expected), |
| 2973 | + 100, 10_000, message); |
2975 | 2974 | }
|
2976 | 2975 |
|
2977 | 2976 | /**
|
|
0 commit comments