@@ -208,21 +208,21 @@ protected void testClientNamedQueueRecoveryWith(String q, boolean noWait) throws
208208
209209 public void testDeclarationOfManyAutoDeleteQueuesWithTransientConsumer () throws IOException {
210210 Channel ch = connection .createChannel ();
211- assertEquals ( 0 , (( AutorecoveringConnection ) connection ). getRecordedQueues (). size () );
211+ assertRecordedQueues ( connection , 0 );
212212 for (int i = 0 ; i < 5000 ; i ++) {
213213 String q = UUID .randomUUID ().toString ();
214- ch .queueDeclareNoWait (q , false , false , true , null );
214+ ch .queueDeclare (q , false , false , true , null );
215215 QueueingConsumer dummy = new QueueingConsumer (ch );
216216 String tag = ch .basicConsume (q , true , dummy );
217217 ch .basicCancel (tag );
218218 }
219- assertEquals ( 0 , (( AutorecoveringConnection ) connection ). getRecordedQueues (). size () );
219+ assertRecordedQueues ( connection , 0 );
220220 ch .close ();
221221 }
222222
223223 public void testDeclarationofManyAutoDeleteExchangesWithTransientQueuesThatAreUnbound () throws IOException {
224224 Channel ch = connection .createChannel ();
225- assertEquals ( 0 , (( AutorecoveringConnection ) connection ). getRecordedExchanges (). size () );
225+ assertRecordedExchanges ( connection , 0 );
226226 for (int i = 0 ; i < 5000 ; i ++) {
227227 String x = UUID .randomUUID ().toString ();
228228 ch .exchangeDeclare (x , "fanout" , false , true , null );
@@ -232,53 +232,53 @@ public void testDeclarationofManyAutoDeleteExchangesWithTransientQueuesThatAreUn
232232 ch .queueUnbind (q , x , rk );
233233 ch .queueDelete (q );
234234 }
235- assertEquals ( 0 , (( AutorecoveringConnection ) connection ). getRecordedExchanges (). size () );
235+ assertRecordedExchanges ( connection , 0 );
236236 ch .close ();
237237 }
238238
239239 public void testDeclarationofManyAutoDeleteExchangesWithTransientQueuesThatAreDeleted () throws IOException {
240240 Channel ch = connection .createChannel ();
241- assertEquals ( 0 , (( AutorecoveringConnection ) connection ). getRecordedExchanges (). size () );
241+ assertRecordedExchanges ( connection , 0 );
242242 for (int i = 0 ; i < 5000 ; i ++) {
243243 String x = UUID .randomUUID ().toString ();
244244 ch .exchangeDeclare (x , "fanout" , false , true , null );
245245 String q = ch .queueDeclare ().getQueue ();
246246 ch .queueBind (q , x , "doesn't matter" );
247247 ch .queueDelete (q );
248248 }
249- assertEquals ( 0 , (( AutorecoveringConnection ) connection ). getRecordedExchanges (). size () );
249+ assertRecordedExchanges ( connection , 0 );
250250 ch .close ();
251251 }
252252
253253 public void testDeclarationofManyAutoDeleteExchangesWithTransientExchangesThatAreUnbound () throws IOException {
254254 Channel ch = connection .createChannel ();
255- assertEquals ( 0 , (( AutorecoveringConnection ) connection ). getRecordedExchanges (). size () );
255+ assertRecordedExchanges ( connection , 0 );
256256 for (int i = 0 ; i < 5000 ; i ++) {
257- String src = UUID .randomUUID ().toString ();
258- String dest = UUID .randomUUID ().toString ();
257+ String src = "src-" + UUID .randomUUID ().toString ();
258+ String dest = "dest-" + UUID .randomUUID ().toString ();
259259 ch .exchangeDeclare (src , "fanout" , false , true , null );
260260 ch .exchangeDeclare (dest , "fanout" , false , true , null );
261261 final String rk = "doesn't matter" ;
262262 ch .exchangeBind (dest , src , rk );
263263 ch .exchangeUnbind (dest , src , rk );
264264 ch .exchangeDelete (dest );
265265 }
266- assertEquals ( 0 , (( AutorecoveringConnection ) connection ). getRecordedExchanges (). size () );
266+ assertRecordedExchanges ( connection , 0 );
267267 ch .close ();
268268 }
269269
270270 public void testDeclarationofManyAutoDeleteExchangesWithTransientExchangesThatAreDeleted () throws IOException {
271271 Channel ch = connection .createChannel ();
272- assertEquals ( 0 , (( AutorecoveringConnection ) connection ). getRecordedExchanges (). size () );
273- for (int i = 0 ; i < 100 ; i ++) {
272+ assertRecordedExchanges ( connection , 0 );
273+ for (int i = 0 ; i < 5000 ; i ++) {
274274 String src = "src-" + UUID .randomUUID ().toString ();
275275 String dest = "dest-" + UUID .randomUUID ().toString ();
276276 ch .exchangeDeclare (src , "fanout" , false , true , null );
277277 ch .exchangeDeclare (dest , "fanout" , false , true , null );
278278 ch .exchangeBind (dest , src , "doesn't matter" );
279279 ch .exchangeDelete (dest );
280280 }
281- assertEquals ( 0 , (( AutorecoveringConnection ) connection ). getRecordedExchanges (). size () );
281+ assertRecordedExchanges ( connection , 0 );
282282 ch .close ();
283283 }
284284
@@ -628,4 +628,12 @@ private static void wait(CountDownLatch latch) throws InterruptedException {
628628 private void waitForConfirms (Channel ch ) throws InterruptedException , TimeoutException {
629629 ch .waitForConfirms (30 * 60 * 1000 );
630630 }
631+
632+ protected void assertRecordedQueues (Connection conn , int size ) {
633+ assertEquals (size , ((AutorecoveringConnection )conn ).getRecordedQueues ().size ());
634+ }
635+
636+ protected void assertRecordedExchanges (Connection conn , int size ) {
637+ assertEquals (size , ((AutorecoveringConnection )conn ).getRecordedExchanges ().size ());
638+ }
631639}
0 commit comments