@@ -66,42 +66,40 @@ public void testAutoDeleteExchangesSimpleLoop() throws IOException {
6666 * build (A -> B) (B -> C) (C -> D) and then delete D. All should autodelete
6767 */
6868 public void testTransientAutoDelete () throws IOException {
69- channel . exchangeDeclare ( "A" , "fanout " , false , true , null ) ;
70- channel . exchangeDeclare ( "B" , "fanout" , false , true , null );
71- channel .exchangeDeclare ("C" , "fanout" , false , true , null );
72- channel . exchangeDeclare ( "D" , "fanout" , false , true , null );
69+ String [] exchanges = new String [] { "A" , "B " , "C" , "D" } ;
70+ for ( String e : exchanges ) {
71+ channel .exchangeDeclare (e , "fanout" , false , true , null );
72+ }
7373
7474 channel .exchangeBind ("B" , "A" , "" );
7575 channel .exchangeBind ("C" , "B" , "" );
7676 channel .exchangeBind ("D" , "C" , "" );
7777
7878 channel .exchangeDelete ("D" );
7979
80- assertExchangeNotExists ("A" );
81- assertExchangeNotExists ("B" );
82- assertExchangeNotExists ("C" );
83- assertExchangeNotExists ("D" );
80+ for (String e : exchanges ) {
81+ assertExchangeNotExists (e );
82+ }
8483 }
8584
8685 /*
8786 * build (A -> B) (B -> C) (C -> D) (Source -> A) (Source -> B) (Source ->
8887 * C) (Source -> D) On removal of D, all should autodelete
8988 */
9089 public void testRepeatedTargetAutoDelete () throws IOException {
91- channel . exchangeDeclare ( "A" , "fanout " , false , true , null ) ;
92- channel . exchangeDeclare ( "B" , "fanout" , false , true , null );
93- channel .exchangeDeclare ("C" , "fanout" , false , true , null );
94- channel . exchangeDeclare ( "D" , "fanout" , false , true , null );
90+ String [] exchanges = new String [] { "A" , "B " , "C" , "D" } ;
91+ for ( String e : exchanges ) {
92+ channel .exchangeDeclare (e , "fanout" , false , true , null );
93+ }
9594 channel .exchangeDeclare ("Source" , "fanout" , false , true , null );
9695
9796 channel .exchangeBind ("B" , "A" , "" );
9897 channel .exchangeBind ("C" , "B" , "" );
9998 channel .exchangeBind ("D" , "C" , "" );
10099
101- channel .exchangeBind ("A" , "Source" , "" );
102- channel .exchangeBind ("B" , "Source" , "" );
103- channel .exchangeBind ("C" , "Source" , "" );
104- channel .exchangeBind ("D" , "Source" , "" );
100+ for (String e : exchanges ) {
101+ channel .exchangeBind (e , "Source" , "" );
102+ }
105103
106104 channel .exchangeDelete ("A" );
107105 // Source should still be there. We'll verify this by redeclaring
@@ -110,10 +108,10 @@ public void testRepeatedTargetAutoDelete() throws IOException {
110108
111109 channel .exchangeDelete ("D" );
112110
111+ for (String e : exchanges ) {
112+ assertExchangeNotExists (e );
113+ }
113114 assertExchangeNotExists ("Source" );
114- assertExchangeNotExists ("A" );
115- assertExchangeNotExists ("B" );
116- assertExchangeNotExists ("C" );
117- assertExchangeNotExists ("D" );
118115 }
116+
119117}
0 commit comments