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