|
34 | 34 | import java.io.IOException; |
35 | 35 |
|
36 | 36 | import com.rabbitmq.client.AMQP; |
37 | | -import com.rabbitmq.client.Channel; |
38 | 37 | import com.rabbitmq.client.test.BrokerTestCase; |
39 | 38 |
|
40 | 39 | public class ExchangeExchangeBindingsAutoDelete extends BrokerTestCase { |
41 | 40 |
|
42 | | - private Channel secondaryChannel = null; |
43 | | - |
44 | | - @Override |
45 | | - protected void createResources() throws IOException { |
46 | | - super.createResources(); |
47 | | - maybeCreateSecondaryChannel(); |
48 | | - } |
49 | | - |
50 | | - private void maybeCreateSecondaryChannel() throws IOException { |
51 | | - if (null != secondaryChannel && ! secondaryChannel.isOpen()) { |
52 | | - secondaryChannel = null; |
53 | | - } |
54 | | - if (null == secondaryChannel) { |
55 | | - secondaryChannel = connection.createChannel(); |
56 | | - } |
57 | | - } |
58 | | - |
59 | | - @Override |
60 | | - protected void releaseResources() throws IOException { |
61 | | - super.releaseResources(); |
62 | | - if (null != secondaryChannel && secondaryChannel.isOpen()) { |
63 | | - secondaryChannel.close(); |
64 | | - } |
65 | | - } |
66 | | - |
67 | 41 | private void assertExchangeNotExists(String name) throws IOException { |
68 | | - maybeCreateSecondaryChannel(); |
69 | 42 | try { |
70 | | - secondaryChannel.exchangeDeclarePassive(name); |
| 43 | + connection.createChannel().exchangeDeclarePassive(name); |
71 | 44 | fail("Exchange " + name + " still exists."); |
72 | 45 | } catch (IOException e) { |
73 | 46 | checkShutdownSignal(AMQP.NOT_FOUND, e); |
|
0 commit comments