NO-JIRA: Fixing ReceiveTest::testReceiveImmediate
This commit is contained in:
parent
83256c5d0d
commit
eab0cb587c
|
@ -31,6 +31,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
|||
import org.apache.activemq.artemis.core.server.Queue;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
||||
import org.apache.activemq.artemis.tests.util.RandomUtil;
|
||||
import org.apache.activemq.artemis.tests.util.Wait;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
@ -38,9 +39,9 @@ import org.junit.Test;
|
|||
|
||||
public class ReceiveTest extends ActiveMQTestBase {
|
||||
|
||||
SimpleString addressA = new SimpleString("addressA");
|
||||
SimpleString addressA;
|
||||
|
||||
SimpleString queueA = new SimpleString("queueA");
|
||||
SimpleString queueA;
|
||||
|
||||
private ServerLocator locator;
|
||||
|
||||
|
@ -51,6 +52,9 @@ public class ReceiveTest extends ActiveMQTestBase {
|
|||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
addressA = RandomUtil.randomSimpleString();
|
||||
queueA = RandomUtil.randomSimpleString();
|
||||
|
||||
locator = createInVMNonHALocator();
|
||||
server = createServer(false);
|
||||
server.start();
|
||||
|
@ -131,9 +135,8 @@ public class ReceiveTest extends ActiveMQTestBase {
|
|||
|
||||
@Test
|
||||
public void testReceiveImmediate() throws Exception {
|
||||
|
||||
// forces perfect round robin
|
||||
locator.setConsumerMaxRate(1);
|
||||
locator.setConsumerWindowSize(0);
|
||||
ClientSessionFactory cf = createSessionFactory(locator);
|
||||
ClientSession sendSession = cf.createSession(false, true, true);
|
||||
ClientProducer cp = sendSession.createProducer(addressA);
|
||||
|
@ -149,15 +152,10 @@ public class ReceiveTest extends ActiveMQTestBase {
|
|||
|
||||
final Queue queue = server.locateQueue(queueA);
|
||||
|
||||
Wait.waitFor(new Wait.Condition() {
|
||||
@Override
|
||||
public boolean isSatisfied() throws Exception {
|
||||
return queue.getMessageCount() == 3;
|
||||
}
|
||||
});
|
||||
Wait.waitFor(() -> queue.getMessageCount() == 3, 500, 100);
|
||||
|
||||
Assert.assertNotNull(cc2.receive(5000));
|
||||
Assert.assertNotNull(cc.receive(5000));
|
||||
Assert.assertNotNull(cc2.receiveImmediate());
|
||||
Assert.assertNotNull(cc.receiveImmediate());
|
||||
if (cc.receiveImmediate() == null) {
|
||||
Assert.assertNotNull(cc2.receiveImmediate());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue