|
16 | 16 | */ |
17 | 17 | package org.apache.logging.log4j.core.async; |
18 | 18 |
|
| 19 | +import static org.assertj.core.api.Assertions.fail; |
19 | 20 | import static org.hamcrest.MatcherAssert.assertThat; |
20 | 21 | import static org.junit.jupiter.api.Assertions.assertEquals; |
21 | 22 | import static org.junit.jupiter.api.Assertions.assertNull; |
@@ -78,11 +79,25 @@ void testIncorrectWaitStrategyFallsBackToDefault( |
78 | 79 | (AsyncLoggerConfig) ((org.apache.logging.log4j.core.Logger) logger).get(); |
79 | 80 | final AsyncLoggerConfigDisruptor delegate = |
80 | 81 | (AsyncLoggerConfigDisruptor) loggerConfig.getAsyncLoggerConfigDelegate(); |
81 | | - assertEquals( |
82 | | - TimeoutBlockingWaitStrategy.class, delegate.getWaitStrategy().getClass()); |
83 | | - assertThat( |
84 | | - "waitstrategy is TimeoutBlockingWaitStrategy", |
85 | | - delegate.getWaitStrategy() instanceof TimeoutBlockingWaitStrategy); |
| 82 | + |
| 83 | + if (DisruptorUtil.DISRUPTOR_MAJOR_VERSION == 3) { |
| 84 | + assertEquals( |
| 85 | + org.apache.logging.log4j.core.async.TimeoutBlockingWaitStrategy.class, |
| 86 | + delegate.getWaitStrategy().getClass()); |
| 87 | + assertThat( |
| 88 | + "waitstrategy is TimeoutBlockingWaitStrategy", |
| 89 | + delegate.getWaitStrategy() |
| 90 | + instanceof org.apache.logging.log4j.core.async.TimeoutBlockingWaitStrategy); |
| 91 | + } else if (DisruptorUtil.DISRUPTOR_MAJOR_VERSION == 4) { |
| 92 | + assertEquals( |
| 93 | + com.lmax.disruptor.TimeoutBlockingWaitStrategy.class, |
| 94 | + delegate.getWaitStrategy().getClass()); |
| 95 | + assertThat( |
| 96 | + "waitstrategy is TimeoutBlockingWaitStrategy", |
| 97 | + delegate.getWaitStrategy() instanceof com.lmax.disruptor.TimeoutBlockingWaitStrategy); |
| 98 | + } else { |
| 99 | + fail("Unhandled Disruptor version " + DisruptorUtil.DISRUPTOR_MAJOR_VERSION); |
| 100 | + } |
86 | 101 | } |
87 | 102 |
|
88 | 103 | public static class YieldingWaitStrategyFactory implements AsyncWaitStrategyFactory { |
|
0 commit comments