This commit is contained in:
Clebert Suconic 2020-04-08 12:19:36 -04:00
commit f78fe47548
3 changed files with 16 additions and 6 deletions

View File

@ -208,16 +208,16 @@ public class AmqpInboundConnectionTest extends AmqpClientTestSupport {
connection2.setContainerId(getTestName() + "-Client:2");
connection1.connect();
assertEquals(1, server.getConnectionCount());
Wait.assertEquals(1, server::getConnectionCount);
connection2.connect();
assertEquals(2, server.getConnectionCount());
Wait.assertEquals(2, server::getConnectionCount);
connection1.close();
assertEquals(1, server.getConnectionCount());
Wait.assertEquals(1, server::getConnectionCount);
connection2.close();
assertEquals(0, server.getConnectionCount());
Wait.assertEquals(0, server::getConnectionCount);
}
@Test(timeout = 60000)

View File

@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.amqp;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.tests.util.Wait;
import org.apache.activemq.transport.amqp.client.AmqpClient;
import org.apache.activemq.transport.amqp.client.AmqpConnection;
import org.apache.activemq.transport.amqp.client.AmqpMessage;
@ -233,7 +234,7 @@ public class AmqpMessagePriorityTest extends AmqpClientTestSupport {
}
receiver.close();
assertEquals(0, queueView.getMessageCount());
Wait.assertEquals(0, queueView::getMessageCount);
connection.close();
}

View File

@ -17,6 +17,8 @@
package org.apache.activemq.artemis.tests.integration.amqp.largemessages;
import java.util.NoSuchElementException;
import org.apache.activemq.artemis.core.postoffice.Binding;
import org.apache.activemq.artemis.core.postoffice.QueueBinding;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
@ -41,7 +43,14 @@ public class AMQPLargeMessagesTestUtil {
public static void validateTemporaryBuffers(Queue serverQueue) {
LinkedListIterator<MessageReference> totalIterator = serverQueue.browserIterator();
while (totalIterator.hasNext()) {
MessageReference ref = totalIterator.next();
MessageReference ref;
try {
ref = totalIterator.next();
} catch (NoSuchElementException e) {
// that's fine, it means the iterator got to the end of the list
// and something else removed it
break;
}
if (ref.getMessage() instanceof AMQPLargeMessage) {
AMQPLargeMessage amqpLargeMessage = (AMQPLargeMessage) ref.getMessage();
// Using a Wait.waitFor here as we may have something working with the buffer in parallel