1616
1717package com .rabbitmq .client .test .functional ;
1818
19+ import static com .rabbitmq .client .test .TestUtils .BrokerVersion .RABBITMQ_4_2 ;
1920import static org .junit .jupiter .api .Assertions .assertNotNull ;
2021import static org .junit .jupiter .api .Assertions .assertNull ;
2122import static org .junit .jupiter .api .Assertions .assertTrue ;
3132import java .util .Map ;
3233import java .util .concurrent .TimeoutException ;
3334
35+ import com .rabbitmq .client .test .TestUtils .BrokerVersionAtMost ;
3436import org .junit .jupiter .api .Test ;
3537
3638import com .rabbitmq .client .AMQP ;
@@ -70,9 +72,7 @@ public void fill(int n)
7072 * receive n messages - check that we receive no fewer and cannot
7173 * receive more
7274 **/
73- public static List <Delivery > drain (QueueingConsumer c , int n )
74- throws IOException
75- {
75+ public static List <Delivery > drain (QueueingConsumer c , int n ) {
7676 List <Delivery > res = new LinkedList <Delivery >();
7777 try {
7878 long start = System .currentTimeMillis ();
@@ -90,9 +90,7 @@ public static List<Delivery> drain(QueueingConsumer c, int n)
9090 return res ;
9191 }
9292
93- @ Test public void messageLimitPrefetchSizeFails ()
94- throws IOException
95- {
93+ @ Test public void messageLimitPrefetchSizeFails () {
9694 try {
9795 channel .basicQos (1000 , 0 , false );
9896 fail ("basic.qos{pretfetch_size=NonZero} should not be supported" );
@@ -101,6 +99,7 @@ public static List<Delivery> drain(QueueingConsumer c, int n)
10199 }
102100 }
103101
102+ @ BrokerVersionAtMost (RABBITMQ_4_2 )
104103 @ Test public void messageLimitUnlimited ()
105104 throws IOException
106105 {
@@ -109,6 +108,7 @@ public static List<Delivery> drain(QueueingConsumer c, int n)
109108 drain (c , 2 );
110109 }
111110
111+ @ BrokerVersionAtMost (RABBITMQ_4_2 )
112112 @ Test public void noAckNoAlterLimit ()
113113 throws IOException
114114 {
@@ -119,6 +119,7 @@ public static List<Delivery> drain(QueueingConsumer c, int n)
119119 drain (c , 2 );
120120 }
121121
122+ @ BrokerVersionAtMost (RABBITMQ_4_2 )
122123 @ Test public void noAckObeysLimit ()
123124 throws IOException
124125 {
@@ -142,6 +143,7 @@ public static List<Delivery> drain(QueueingConsumer c, int n)
142143 drain (c2 , 1 );
143144 }
144145
146+ @ BrokerVersionAtMost (RABBITMQ_4_2 )
145147 @ Test public void permutations ()
146148 throws IOException
147149 {
@@ -159,6 +161,7 @@ public static List<Delivery> drain(QueueingConsumer c, int n)
159161 }
160162 }
161163
164+ @ BrokerVersionAtMost (RABBITMQ_4_2 )
162165 @ Test public void fairness ()
163166 throws IOException
164167 {
@@ -188,6 +191,7 @@ public static List<Delivery> drain(QueueingConsumer c, int n)
188191
189192 }
190193
194+ @ BrokerVersionAtMost (RABBITMQ_4_2 )
191195 @ Test public void singleChannelAndQueueFairness ()
192196 throws IOException
193197 {
@@ -237,6 +241,7 @@ public static List<Delivery> drain(QueueingConsumer c, int n)
237241 assertTrue (counts .get ("c2" ).intValue () > 0 );
238242 }
239243
244+ @ BrokerVersionAtMost (RABBITMQ_4_2 )
240245 @ Test public void consumerLifecycle ()
241246 throws IOException
242247 {
@@ -258,6 +263,7 @@ public static List<Delivery> drain(QueueingConsumer c, int n)
258263 channel .queueDelete (queue );
259264 }
260265
266+ @ BrokerVersionAtMost (RABBITMQ_4_2 )
261267 @ Test public void setLimitAfterConsume ()
262268 throws IOException
263269 {
@@ -273,6 +279,7 @@ public static List<Delivery> drain(QueueingConsumer c, int n)
273279 drain (c , 1 );
274280 }
275281
282+ @ BrokerVersionAtMost (RABBITMQ_4_2 )
276283 @ Test public void limitIncrease ()
277284 throws IOException
278285 {
@@ -282,6 +289,7 @@ public static List<Delivery> drain(QueueingConsumer c, int n)
282289 drain (c , 1 );
283290 }
284291
292+ @ BrokerVersionAtMost (RABBITMQ_4_2 )
285293 @ Test public void limitDecrease ()
286294 throws IOException
287295 {
@@ -293,6 +301,7 @@ public static List<Delivery> drain(QueueingConsumer c, int n)
293301 drain (c , 1 );
294302 }
295303
304+ @ BrokerVersionAtMost (RABBITMQ_4_2 )
296305 @ Test public void limitedToUnlimited ()
297306 throws IOException
298307 {
@@ -302,6 +311,7 @@ public static List<Delivery> drain(QueueingConsumer c, int n)
302311 drain (c , 2 );
303312 }
304313
314+ @ BrokerVersionAtMost (RABBITMQ_4_2 )
305315 @ Test public void limitingMultipleChannels ()
306316 throws IOException
307317 {
@@ -326,6 +336,7 @@ public static List<Delivery> drain(QueueingConsumer c, int n)
326336 ch2 .abort ();
327337 }
328338
339+ @ BrokerVersionAtMost (RABBITMQ_4_2 )
329340 @ Test public void limitInheritsUnackedCount ()
330341 throws IOException
331342 {
@@ -338,6 +349,7 @@ public static List<Delivery> drain(QueueingConsumer c, int n)
338349 drain (c , 1 );
339350 }
340351
352+ @ BrokerVersionAtMost (RABBITMQ_4_2 )
341353 @ Test public void recoverReducesLimit () throws Exception {
342354 channel .basicQos (2 , true );
343355 QueueingConsumer c = new QueueingConsumer (channel );
0 commit comments