Skip to content

Commit 239c5d6

Browse files
author
Jerry Kuch
committed
Various cleanups:
- ChannelN exchangeDeclares now flow through most general sibling method. - InternalExchange functional test renamed for consistency. - InternalExchange functional test now uses auto-delete and exclusive queues and an auto-delete exchange to obviate test's need to explicitly release resources. - Spurious isOpen() check on channel in InternalExchange removed.
1 parent 8674e46 commit 239c5d6

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

src/com/rabbitmq/client/impl/ChannelN.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,10 +515,9 @@ public Exchange.DeclareOk exchangeDeclare(String exchange, String type,
515515
Map<String, Object> arguments)
516516
throws IOException
517517
{
518-
return (Exchange.DeclareOk)
519-
exnWrappingRpc(new Exchange.Declare(TICKET, exchange, type,
520-
false, durable, autoDelete,
521-
false, false, arguments)).getMethod();
518+
return exchangeDeclare(exchange, type,
519+
durable, autoDelete, false,
520+
arguments);
522521
}
523522

524523
/** Public API - {@inheritDoc} */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public static TestSuite suite() {
7070
suite.addTestSuite(Confirm.class);
7171
suite.addTestSuite(UnexpectedFrames.class);
7272
suite.addTestSuite(PerQueueTTL.class);
73-
suite.addTestSuite(InternalExchangeTest.class);
73+
suite.addTestSuite(InternalExchange.class);
7474
return suite;
7575
}
7676
}

test/src/com/rabbitmq/client/test/functional/InternalExchangeTest.java renamed to test/src/com/rabbitmq/client/test/functional/InternalExchange.java

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,25 @@
5656
// turn is bound to a queue. A client should be able to publish to e0, but
5757
// not to e1, and publications to e0 should be delivered into q1.
5858
//
59-
public class InternalExchangeTest extends BrokerTestCase
59+
public class InternalExchange extends BrokerTestCase
6060
{
6161
private final String[] queues = new String[] { "q1" };
6262
private final String[] exchanges = new String[] { "e0", "e1" };
6363

6464
protected void createResources() throws IOException
6565
{
66+
// The queues and exchange we create here are all auto-delete, so we
67+
// don't need to override releaseResources() with their deletions...
6668
for (String q : queues)
6769
{
68-
channel.queueDeclare(q, false, false, false, null);
70+
channel.queueDeclare(q, false, true, true, null);
6971
}
7072

7173
// The second exchange, "e1", will be an 'internal' one.
7274
for ( String e : exchanges )
7375
{
7476
channel.exchangeDeclare(e, "direct",
75-
false, false,
77+
false, true,
7678
!e.equals("e0"),
7779
null);
7880
}
@@ -81,19 +83,6 @@ protected void createResources() throws IOException
8183
channel.queueBind("q1", "e1", "");
8284
}
8385

84-
@Override
85-
protected void releaseResources() throws IOException
86-
{
87-
for (String q : queues)
88-
{
89-
channel.queueDelete(q);
90-
}
91-
for (String e : exchanges)
92-
{
93-
channel.exchangeDelete(e);
94-
}
95-
}
96-
9786

9887
public void testTryPublishingToInternalExchange()
9988
throws IOException
@@ -103,7 +92,6 @@ public void testTryPublishingToInternalExchange()
10392
// We should be able to publish to the non-internal exchange as usual
10493
// and see our message land in the queue...
10594
channel.basicPublish("e0", "", null, testDataBody);
106-
assertTrue(channel.isOpen());
10795
GetResponse r = channel.basicGet("q1", true);
10896
assertTrue(Arrays.equals(r.getBody(), testDataBody));
10997

0 commit comments

Comments
 (0)