Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARTEMIS-415 - [Artemis Testsuite] NettyPagingSendTest#testPagingDoesN… #398

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -233,6 +233,9 @@ public void testPagingDoesNotDuplicateBatchMessages() throws Exception {

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++) {
Expand Down Expand Up @@ -324,6 +327,18 @@ public void checkBatchMessagesAreNotPagedTwice(Queue queue) throws Exception {
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
Expand Down