@@ -563,28 +563,22 @@ public void queueRecovered(String oldName, String newName) {
563563 @ Test public void thatExcludedQueueDoesNotReappearOnRecover () throws IOException , InterruptedException {
564564 final String q = "java-client.test.recovery.excludedQueue1" ;
565565 channel .queueDeclare (q , true , false , false , null );
566- boolean deleted = false ;
566+ // now delete it using the delegate so AutorecoveringConnection and AutorecoveringChannel are not aware of it
567+ ((AutorecoveringChannel )channel ).getDelegate ().queueDelete (q );
568+ assertNotNull (((AutorecoveringConnection )connection ).getRecordedQueues ().get (q ));
569+ // exclude the queue from recovery
570+ ((AutorecoveringConnection )connection ).excludeQueueFromRecovery (q , true );
571+ // verify its not there
572+ assertNull (((AutorecoveringConnection )connection ).getRecordedQueues ().get (q ));
573+ // reconnect
574+ closeAndWaitForRecovery ();
575+ expectChannelRecovery (channel );
576+ // verify queue was not recreated
567577 try {
568- // now delete it using the delegate so AutorecoveringConnection and AutorecoveringChannel are not aware of it
569- ((AutorecoveringChannel )channel ).getDelegate ().queueDelete (q );
570- assertNotNull (((AutorecoveringConnection )connection ).getRecordedQueues ().get (q ));
571- // exclude the queue from recovery
572- ((AutorecoveringConnection )connection ).excludeQueueFromRecovery (q , true );
573- // verify its not there
574- assertNull (((AutorecoveringConnection )connection ).getRecordedQueues ().get (q ));
575- // reconnect
576- closeAndWaitForRecovery ();
577- expectChannelRecovery (channel );
578- // verify queue was not recreated
579- try {
580- channel .queueDeclarePassive (q );
581- fail ("Expected passive declare to fail" );
582- } catch (IOException ioe ) {
583- // expected
584- }
585- } finally {
586- if (!deleted )
587- channel .queueDelete (q );
578+ channel .queueDeclarePassive (q );
579+ fail ("Expected passive declare to fail" );
580+ } catch (IOException ioe ) {
581+ // expected
588582 }
589583 }
590584
0 commit comments