Skip to content

Commit 7ce6453

Browse files
author
Matthew Sackman
committed
merged in bug20590
2 parents f0c025a + f80f618 commit 7ce6453

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

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

34+
import com.rabbitmq.client.Channel;
35+
import com.rabbitmq.client.Connection;
3436
import com.rabbitmq.client.GetResponse;
3537
import com.rabbitmq.client.QueueingConsumer;
3638

@@ -53,6 +55,29 @@ public class BindingLifecycle extends PersisterRestartBase {
5355
protected static final String X = "X-" + System.currentTimeMillis();
5456
protected static final String K = "K-" + System.currentTimeMillis();
5557

58+
/**
59+
* Create a durable queue on secondary node, if possible, falling
60+
* back on the primary node if necessary.
61+
*/
62+
@Override protected void declareDurableQueue(String q)
63+
throws IOException
64+
{
65+
Connection connection;
66+
try {
67+
connection = connectionFactory.newConnection("localhost", 5673);
68+
} catch (IOException e) {
69+
super.declareDurableQueue(q);
70+
return;
71+
}
72+
73+
Channel channel = connection.createChannel();
74+
75+
channel.queueDeclare(q, true);
76+
77+
channel.abort();
78+
connection.abort();
79+
}
80+
5681
/**
5782
* Tests whether durable bindings are correctly recovered.
5883
*/
@@ -112,7 +137,7 @@ public void testDurableBindingsDeletion() throws IOException {
112137

113138

114139
/**
115-
* This tests whether the default bindings for persistent queues
140+
* This tests whether the default bindings for durable queues
116141
* are recovered properly.
117142
*
118143
* The idea is to create a durable queue, nuke the server and then

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected void declareDurableQueue(String q)
8989
protected void declareAndBindDurableQueue(String q, String x, String r)
9090
throws IOException
9191
{
92-
channel.queueDeclare(q, true);
92+
declareDurableQueue(q);
9393
channel.queueBind(q, x, r);
9494
}
9595

0 commit comments

Comments
 (0)