ARTEMIS-415 - [Artemis Testsuite] NettyPagingSendTest#testPagingDoesNotDuplicateBatchMessages

This commit is contained in:
Erich Duda 2016-02-22 09:23:23 +01:00 committed by Clebert Suconic
parent 51d033adec
commit a4c4f811eb
1 changed files with 15 additions and 0 deletions

View File

@ -233,6 +233,9 @@ public class PagingSendTest extends ActiveMQTestBase {
Queue queue = server.locateQueue(queueAddr);
// Give time Queue.deliverAsync to deliver messages
Assert.assertTrue("Messages were not propagated to internal structures.", waitForMessages(queue, batchSize, 3000));
checkBatchMessagesAreNotPagedTwice(queue);
for (int i = 0; i < 10; i++) {
@ -324,6 +327,18 @@ public class PagingSendTest extends ActiveMQTestBase {
assertTrue(duplicates == 0);
}
public boolean waitForMessages(Queue queue, int count, long timeout) throws Exception {
long timeToWait = System.currentTimeMillis() + timeout;
while (System.currentTimeMillis() < timeToWait) {
if (queue.getMessageCount() >= count) {
return true;
}
Thread.sleep(100);
}
return false;
}
/**
* checks that there are no message duplicates in the page. Any IDs found in the ignoreIds field will not be tested
* this allows us to test only those messages that have been sent after the address has started paging (ignoring any