Skip to content

Commit eb8c0d3

Browse files
author
Jerry Kuch
committed
Address QA cleanups in functional test.
1 parent f1373c7 commit eb8c0d3

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

test/src/com/rabbitmq/client/test/functional/InternalExchangeTest.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
package com.rabbitmq.client.test.functional;
3333

34+
import com.rabbitmq.client.DefaultConsumer;
3435
import com.rabbitmq.client.GetResponse;
3536
import com.rabbitmq.client.QueueingConsumer;
3637
import com.rabbitmq.client.ShutdownSignalException;
@@ -62,22 +63,19 @@ public class InternalExchangeTest extends BrokerTestCase
6263
private final String[] queues = new String[] { "q1" };
6364
private final String[] exchanges = new String[] { "e0", "e1" };
6465

65-
private QueueingConsumer[] consumers =
66-
new QueueingConsumer[] { null, null, null };
67-
6866
protected void createResources() throws IOException
6967
{
7068
for (String q : queues)
7169
{
7270
channel.queueDeclare(q, false, false, false, null);
7371
}
7472

75-
// First exchange will be an 'internal' one.
73+
// The second exchange, "e1", will be an 'internal' one.
7674
for ( String e : exchanges )
7775
{
7876
channel.exchangeDeclare(e, "direct",
7977
false, false,
80-
e.equals("e0") ? false : true,
78+
!e.equals("e0"),
8179
null);
8280
}
8381

@@ -118,9 +116,10 @@ public void testTryPublishingToInternalExchange()
118116
channel.basicPublish("e1", "", null, testDataBody);
119117
try
120118
{
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);
124123
fail("Channel should have shut down with 403 (access refused).");
125124
}
126125
catch (IOException e)

0 commit comments

Comments
 (0)