3535import java .util .HashMap ;
3636import java .io .IOException ;
3737
38- import com .rabbitmq .client .AMQP ;
39- import com .rabbitmq .client .Channel ;
40-
41- import com .rabbitmq .client .test .BrokerTestCase ;
42-
43- public class ExchangeDeclare extends BrokerTestCase {
38+ public class ExchangeDeclare extends ExchangeEquivalenceBase {
4439
4540 static final String TYPE = "direct" ;
4641
@@ -50,51 +45,30 @@ public void releaseResources() throws IOException {
5045 channel .exchangeDelete (NAME );
5146 }
5247
53- public static void verifyEquivalent (BrokerTestCase btc , String name ,
54- String type , boolean durable , boolean autoDelete ,
55- Map <String , Object > args ) throws IOException {
56- btc .channel .exchangeDeclarePassive (name );
57- btc .channel .exchangeDeclare (name , type , durable , autoDelete , args );
58- }
59-
60- // Note: this will close the channel
61- public static void verifyNotEquivalent (BrokerTestCase btc , String name ,
62- String type , boolean durable , boolean autoDelete ,
63- Map <String , Object > args ) throws IOException {
64- btc .channel .exchangeDeclarePassive (name );
65- try {
66- btc .channel .exchangeDeclare (name , type , durable , autoDelete , args );
67- fail ("Exchange was supposed to be not equivalent" );
68- } catch (IOException ioe ) {
69- btc .checkShutdownSignal (AMQP .NOT_ALLOWED , ioe );
70- return ;
71- }
72- }
73-
7448 public void testExchangeNoArgsEquivalence () throws IOException {
7549 channel .exchangeDeclare (NAME , TYPE , false , false , null );
76- verifyEquivalent (this , NAME , TYPE , false , false , null );
50+ verifyEquivalent (NAME , TYPE , false , false , null );
7751 }
7852
7953 public void testExchangeNonsenseArgsEquivalent () throws IOException {
8054 channel .exchangeDeclare (NAME , TYPE , false , false , null );
8155 Map <String , Object > args = new HashMap <String , Object >();
8256 args .put ("nonsensical-argument-surely-not-in-use" , "foo" );
83- verifyEquivalent (this , NAME , TYPE , false , false , args );
57+ verifyEquivalent (NAME , TYPE , false , false , args );
8458 }
8559
8660 public void testExchangeDurableNotEquivalent () throws IOException {
8761 channel .exchangeDeclare (NAME , TYPE , false , false , null );
88- verifyNotEquivalent (this , NAME , TYPE , true , false , null );
62+ verifyNotEquivalent (NAME , TYPE , true , false , null );
8963 }
9064
9165 public void testExchangeTypeNotEquivalent () throws IOException {
9266 channel .exchangeDeclare (NAME , "direct" , false , false , null );
93- verifyNotEquivalent (this , NAME , "fanout" , false , false , null );
67+ verifyNotEquivalent (NAME , "fanout" , false , false , null );
9468 }
9569
9670 public void testExchangeAutoDeleteNotEquivalent () throws IOException {
9771 channel .exchangeDeclare (NAME , "direct" , false , false , null );
98- verifyNotEquivalent (this , NAME , "direct" , false , true , null );
72+ verifyNotEquivalent (NAME , "direct" , false , true , null );
9973 }
10074}
0 commit comments