Skip to content

Commit 784c576

Browse files
author
Emile Joubert
committed
Update CcRoutes tests
1 parent ea23cc6 commit 784c576

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

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

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class CcRoutes extends BrokerTestCase {
4646

4747
static private String[] queues = new String[]{"queue1", "queue2", "queue3"};
4848
protected String exDirect = "direct_cc_exchange";
49-
protected String exFanout = "fanout_cc_exchange";
49+
protected String exTopic = "topic_cc_exchange";
5050
protected BasicProperties props;
5151
protected Map headers;
5252
protected List ccList;
@@ -66,15 +66,15 @@ public class CcRoutes extends BrokerTestCase {
6666
channel.queueDeclare(q, false, false, false, null);
6767
}
6868
channel.exchangeDeclare(exDirect, "direct");
69-
channel.exchangeDeclare(exFanout, "fanout");
69+
channel.exchangeDeclare(exTopic, "topic");
7070
}
7171

7272
@Override protected void releaseResources() throws IOException {
7373
for (String q : queues) {
7474
channel.queueDelete(q);
7575
}
7676
channel.exchangeDelete(exDirect);
77-
channel.exchangeDelete(exFanout);
77+
channel.exchangeDelete(exTopic);
7878
super.releaseResources();
7979
}
8080

@@ -113,13 +113,23 @@ public void testNoDuplicates() throws IOException {
113113

114114
public void testDirectExchangeWithoutBindings() throws IOException {
115115
ccList.add("queue1");
116-
headerPublish(exDirect, "unbound", ccList, null);
117-
expect(new String[] {"queue1"});
116+
headerPublish(exDirect, "queue2", ccList, null);
117+
expect(new String[] {});
118118
}
119119

120-
public void testFanoutExchange() throws IOException {
121-
ccList.add("queue2");
122-
headerPublish(exFanout, "queue1", ccList, null);
120+
public void testTopicExchange() throws IOException {
121+
ccList.add("routing_key");
122+
channel.queueBind("queue2", exTopic, "routing_key");
123+
headerPublish(exTopic, "", ccList, null);
124+
expect(new String[] {"queue2"});
125+
}
126+
127+
public void testBoundExchanges() throws IOException {
128+
ccList.add("routing_key1");
129+
bccList.add("routing_key2");
130+
channel.exchangeBind(exTopic, exDirect, "routing_key1");
131+
channel.queueBind("queue2", exTopic, "routing_key2");
132+
headerPublish(exDirect, "", ccList, bccList);
123133
expect(new String[] {"queue2"});
124134
}
125135

0 commit comments

Comments
 (0)