ARTEMIS-415 - [Artemis Testsuite] NettyPagingSendTest#testPagingDoesNotDuplicateBatchMessages
This commit is contained in:
parent
51d033adec
commit
a4c4f811eb
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue