Skip to content

Commit 2b42106

Browse files
author
Alexandru Scvortov
committed
recover test + refactoring
1 parent 073f1f6 commit 2b42106

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

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

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ public void handleAck(long seqNo,
6666
}
6767
});
6868
channel.confirmSelect(true);
69-
channel.queueDeclare("confirm-test", true, true, true, null);
69+
channel.queueDeclare("confirm-test", true, true, false, null);
7070
channel.basicConsume("confirm-test", true, new DefaultConsumer(channel));
71-
channel.queueDeclare("confirm-test-nondurable", false, false, true, null);
71+
channel.queueDeclare("confirm-test-nondurable", false, false, false, null);
7272
channel.basicConsume("confirm-test-nondurable", true,
7373
new DefaultConsumer(channel));
74-
channel.queueDeclare("confirm-test-noconsumer", true, true, true, null);
75-
channel.queueDeclare("confirm-test-2", true, true, true, null);
74+
channel.queueDeclare("confirm-test-noconsumer", true, true, false, null);
75+
channel.queueDeclare("confirm-test-2", true, true, false, null);
7676
channel.basicConsume("confirm-test-2", true, new DefaultConsumer(channel));
7777
Map<String, Object> argMap = Collections.singletonMap(TTL_ARG, (Object)1);
78-
channel.queueDeclare("confirm-ttl", true, true, true, argMap);
78+
channel.queueDeclare("confirm-ttl", true, true, false, argMap);
7979
channel.queueBind("confirm-test", "amq.direct", "confirm-multiple-queues");
8080
channel.queueBind("confirm-test-2", "amq.direct", "confirm-multiple-queues");
8181
}
@@ -154,9 +154,11 @@ public void testConfirmQueuePurge()
154154
public void testConfirmBasicReject()
155155
throws IOException, InterruptedException
156156
{
157+
System.out.println("basic.reject test 1");
157158
basicRejectCommon(false);
158159

159160
waitAcks();
161+
System.out.println("basic reject test 1 end");
160162
}
161163

162164
public void testConfirmQueueTTL()
@@ -182,6 +184,28 @@ public void testConfirmBasicRejectRequeue()
182184
waitAcks();
183185
}
184186

187+
public void testConfirmBasicRecover()
188+
throws IOException, InterruptedException
189+
{
190+
publishN("", "confirm-test-noconsumer", true, false, false);
191+
192+
for (long i = 0; i < NUM_MESSAGES; i++) {
193+
GetResponse resp = channel.basicGet("confirm-test-noconsumer", false);
194+
long dtag = resp.getEnvelope().getDeliveryTag();
195+
// not acking
196+
}
197+
198+
channel.basicRecover(true);
199+
200+
Thread.sleep(1000);
201+
202+
/* duplicate confirms mean recovered messages were confirmed */
203+
channel.basicConsume("confirm-test-noconsumer", true,
204+
new DefaultConsumer(channel));
205+
206+
waitAcks();
207+
}
208+
185209
/* Publish NUM_MESSAGES persistent messages and wait for
186210
* confirmations. */
187211
public void confirmTest(String exchange, String queueName,

0 commit comments

Comments
 (0)