Skip to content

Commit 0b81f34

Browse files
author
Alexandru Scvortov
committed
add default exchange tests
1 parent 250573a commit 0b81f34

File tree

3 files changed

+46
-20
lines changed

3 files changed

+46
-20
lines changed

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

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.rabbitmq.client.test.functional;
2+
3+
import com.rabbitmq.client.AMQP;
4+
import com.rabbitmq.client.test.BrokerTestCase;
5+
6+
import java.io.IOException;
7+
8+
/**
9+
* See bug 21843. It's not obvious this is the right thing to do, but it's in
10+
* the spec.
11+
*/
12+
public class DefaultExchange extends BrokerTestCase {
13+
String queueName;
14+
15+
@Override
16+
protected void createResources() throws IOException {
17+
queueName = channel.queueDeclare().getQueue();
18+
}
19+
20+
// See bug 22101: publish is the only operation permitted on the
21+
// default exchange
22+
23+
public void testDefaultExchangePublish() throws IOException {
24+
basicPublishVolatile("", queueName); // Implicit binding
25+
assertDelivered(queueName, 1);
26+
}
27+
28+
public void testBindToDefaultExchange() throws IOException {
29+
try {
30+
channel.queueBind(queueName, "", "foobar");
31+
fail();
32+
} catch (IOException ioe) {
33+
checkShutdownSignal(AMQP.ACCESS_REFUSED, ioe);
34+
}
35+
}
36+
37+
public void testConfigureDefaultExchange() throws IOException {
38+
try {
39+
channel.exchangeDeclare("", "direct", true);
40+
fail();
41+
} catch (IOException ioe) {
42+
checkShutdownSignal(AMQP.ACCESS_REFUSED, ioe);
43+
}
44+
}
45+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static TestSuite suite() {
6363
suite.addTestSuite(QueueExclusivity.class);
6464
suite.addTestSuite(InvalidAcks.class);
6565
suite.addTestSuite(InvalidAcksTx.class);
66-
suite.addTestSuite(BindToDefaultExchange.class);
66+
suite.addTestSuite(DefaultExchange.class);
6767
suite.addTestSuite(UnbindAutoDeleteExchange.class);
6868
suite.addTestSuite(RecoverAfterCancel.class);
6969
suite.addTestSuite(UnexpectedFrames.class);

0 commit comments

Comments
 (0)