This closes #638
This commit is contained in:
commit
9df39ad569
|
@ -46,6 +46,7 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator;
|
|||
import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder;
|
||||
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
|
||||
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
|
||||
import org.apache.activemq.artemis.api.jms.management.DestinationControl;
|
||||
import org.apache.activemq.artemis.api.jms.management.JMSQueueControl;
|
||||
import org.apache.activemq.artemis.api.jms.management.JMSServerControl;
|
||||
import org.apache.activemq.artemis.core.config.Configuration;
|
||||
|
@ -1451,6 +1452,8 @@ public class JMSQueueControlTest extends ManagementTestBase {
|
|||
|
||||
JMSQueueControl control = createManagementControl(pagedQueue);
|
||||
|
||||
Assert.assertTrue(waitForMessages(control, 100, 5000));
|
||||
|
||||
assertEquals(100, control.removeMessages(" "));
|
||||
|
||||
session.start();
|
||||
|
@ -1667,6 +1670,18 @@ public class JMSQueueControlTest extends ManagementTestBase {
|
|||
return ManagementControlHelper.createJMSQueueControl(queueParameter, mbeanServer);
|
||||
}
|
||||
|
||||
protected boolean waitForMessages(DestinationControl control, int count, long timeout) throws Exception {
|
||||
long timeToWait = System.currentTimeMillis() + timeout;
|
||||
|
||||
while (System.currentTimeMillis() < timeToWait) {
|
||||
if (control.getMessageCount() == count) {
|
||||
return true;
|
||||
}
|
||||
Thread.sleep(100);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Private -------------------------------------------------------
|
||||
|
||||
private Connection createConnection() throws JMSException {
|
||||
|
|
Loading…
Reference in New Issue