|
31 | 31 |
|
32 | 32 | package com.rabbitmq.client.test.functional; |
33 | 33 |
|
| 34 | +import com.rabbitmq.client.DefaultConsumer; |
34 | 35 | import com.rabbitmq.client.GetResponse; |
35 | 36 | import com.rabbitmq.client.QueueingConsumer; |
36 | 37 | import com.rabbitmq.client.ShutdownSignalException; |
@@ -62,22 +63,19 @@ public class InternalExchangeTest extends BrokerTestCase |
62 | 63 | private final String[] queues = new String[] { "q1" }; |
63 | 64 | private final String[] exchanges = new String[] { "e0", "e1" }; |
64 | 65 |
|
65 | | - private QueueingConsumer[] consumers = |
66 | | - new QueueingConsumer[] { null, null, null }; |
67 | | - |
68 | 66 | protected void createResources() throws IOException |
69 | 67 | { |
70 | 68 | for (String q : queues) |
71 | 69 | { |
72 | 70 | channel.queueDeclare(q, false, false, false, null); |
73 | 71 | } |
74 | 72 |
|
75 | | - // First exchange will be an 'internal' one. |
| 73 | + // The second exchange, "e1", will be an 'internal' one. |
76 | 74 | for ( String e : exchanges ) |
77 | 75 | { |
78 | 76 | channel.exchangeDeclare(e, "direct", |
79 | 77 | false, false, |
80 | | - e.equals("e0") ? false : true, |
| 78 | + !e.equals("e0"), |
81 | 79 | null); |
82 | 80 | } |
83 | 81 |
|
@@ -118,9 +116,10 @@ public void testTryPublishingToInternalExchange() |
118 | 116 | channel.basicPublish("e1", "", null, testDataBody); |
119 | 117 | try |
120 | 118 | { |
121 | | - // This blocking operation will fail because our bad attempt to |
122 | | - // to the internal exchange... |
123 | | - channel.basicGet("q1", true); |
| 119 | + // The channel should have shut down as a result of the forbidden |
| 120 | + // attempt to publish to an internal exchange... |
| 121 | + DefaultConsumer consumer = new DefaultConsumer(channel); |
| 122 | + channel.basicConsume("q1", consumer); |
124 | 123 | fail("Channel should have shut down with 403 (access refused)."); |
125 | 124 | } |
126 | 125 | catch (IOException e) |
|
0 commit comments