Skip to content

Commit 54c9b7e

Browse files
author
Simon MacMullen
committed
Merge bug24606
2 parents 3cd6552 + ec4b675 commit 54c9b7e

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.rabbitmq.client.test.server;
2+
3+
import com.rabbitmq.client.MessageProperties;
4+
import com.rabbitmq.client.test.BrokerTestCase;
5+
6+
import java.io.IOException;
7+
8+
public class PersistenceGuarantees extends BrokerTestCase {
9+
private static final int COUNT = 10000;
10+
private String queue;
11+
12+
protected void declareQueue() throws IOException {
13+
queue = channel.queueDeclare("", true, false, false, null).getQueue();
14+
}
15+
16+
public void testTxPersistence() throws Exception {
17+
declareQueue();
18+
channel.txSelect();
19+
publish();
20+
channel.txCommit();
21+
restart();
22+
assertPersisted();
23+
}
24+
25+
public void testConfirmPersistence() throws Exception {
26+
declareQueue();
27+
channel.confirmSelect();
28+
publish();
29+
channel.waitForConfirms();
30+
restart();
31+
assertPersisted();
32+
}
33+
34+
private void assertPersisted() throws IOException {
35+
assertEquals(COUNT, channel.queueDelete(queue).getMessageCount());
36+
}
37+
38+
private void publish() throws IOException {
39+
for (int i = 0; i < COUNT; i++) {
40+
channel.basicPublish("", queue, false, false, MessageProperties.PERSISTENT_BASIC, "".getBytes());
41+
}
42+
}
43+
}

test/src/com/rabbitmq/client/test/server/ServerTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public static TestSuite suite() {
3131
suite.addTestSuite(MemoryAlarms.class);
3232
suite.addTestSuite(MessageRecovery.class);
3333
suite.addTestSuite(Firehose.class);
34+
suite.addTestSuite(PersistenceGuarantees.class);
3435
return suite;
3536
}
3637
}

0 commit comments

Comments
 (0)