|
7 | 7 | import org.junit.jupiter.api.Test; |
8 | 8 | import reactor.core.publisher.Mono; |
9 | 9 | import reactor.test.StepVerifier; |
| 10 | +import reactor.test.scheduler.VirtualTimeScheduler; |
10 | 11 |
|
11 | 12 | import java.io.IOException; |
12 | 13 | import java.time.Duration; |
@@ -34,7 +35,9 @@ void setUp() throws IOException { |
34 | 35 | @Test |
35 | 36 | void testChannelPoolLazyInitialization() throws Exception { |
36 | 37 | int maxChannelPoolSize = 2; |
37 | | - ChannelPoolOptions channelPoolOptions = new ChannelPoolOptions().maxSize(maxChannelPoolSize); |
| 38 | + ChannelPoolOptions channelPoolOptions = new ChannelPoolOptions() |
| 39 | + .maxCacheSize(maxChannelPoolSize) |
| 40 | + .subscriptionScheduler(VirtualTimeScheduler.create()); |
38 | 41 | lazyChannelPool = new LazyChannelPool(Mono.just(connection), channelPoolOptions); |
39 | 42 |
|
40 | 43 | StepVerifier.withVirtualTime(() -> |
@@ -67,7 +70,9 @@ void testChannelPoolLazyInitialization() throws Exception { |
67 | 70 | @Test |
68 | 71 | void testChannelPoolExceedsMaxPoolSize() throws Exception { |
69 | 72 | int maxChannelPoolSize = 2; |
70 | | - ChannelPoolOptions channelPoolOptions = new ChannelPoolOptions().maxSize(maxChannelPoolSize); |
| 73 | + ChannelPoolOptions channelPoolOptions = new ChannelPoolOptions() |
| 74 | + .maxCacheSize(maxChannelPoolSize) |
| 75 | + .subscriptionScheduler(VirtualTimeScheduler.create()); |
71 | 76 | lazyChannelPool = new LazyChannelPool(Mono.just(connection), channelPoolOptions); |
72 | 77 |
|
73 | 78 | StepVerifier.withVirtualTime(() -> |
@@ -107,7 +112,9 @@ void testChannelPoolExceedsMaxPoolSize() throws Exception { |
107 | 112 | @Test |
108 | 113 | void testChannelPool() throws Exception { |
109 | 114 | int maxChannelPoolSize = 1; |
110 | | - ChannelPoolOptions channelPoolOptions = new ChannelPoolOptions().maxSize(maxChannelPoolSize); |
| 115 | + ChannelPoolOptions channelPoolOptions = new ChannelPoolOptions() |
| 116 | + .maxCacheSize(maxChannelPoolSize) |
| 117 | + .subscriptionScheduler(VirtualTimeScheduler.create()); |
111 | 118 | lazyChannelPool = new LazyChannelPool(Mono.just(connection), channelPoolOptions); |
112 | 119 |
|
113 | 120 | StepVerifier.withVirtualTime(() -> |
@@ -170,7 +177,7 @@ private void verifyBasicPublishOnce(Channel channel) throws Exception { |
170 | 177 | } |
171 | 178 |
|
172 | 179 | private void verifyBasicPublish(Channel channel, int times) throws Exception { |
173 | | - verify(channel, times(times)).basicPublish(anyString(), anyString(), any(AMQP.BasicProperties.class), any(byte[].class)); |
| 180 | + verify(channel, times(times)).basicPublish(anyString(), anyString(), nullable(AMQP.BasicProperties.class), any(byte[].class)); |
174 | 181 | } |
175 | 182 |
|
176 | 183 | private Channel channel(int channelNumber) { |
|
0 commit comments