NO-JIRA Fixing ScaleDownDirectTest and ReconnectTest

This commit is contained in:
Clebert Suconic 2019-08-27 16:52:02 -04:00
parent 3293aba119
commit 3a58387bd3
2 changed files with 8 additions and 3 deletions

View File

@ -428,7 +428,11 @@ public class ReconnectTest extends ActiveMQTestBase {
}
private int getConsumerCount(ActiveMQServer server, ClientSessionInternal session) {
Set<ServerConsumer> serverConsumers = server.getSessionByID(session.getName()).getServerConsumers();
ServerSession serverSession = server.getSessionByID(session.getName());
if (serverSession == null) {
return 0;
}
Set<ServerConsumer> serverConsumers = serverSession.getServerConsumers();
return serverConsumers.size();
}

View File

@ -32,6 +32,7 @@ import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding;
import org.apache.activemq.artemis.core.server.impl.ScaleDownHandler;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
import org.apache.activemq.artemis.tests.util.Wait;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -220,8 +221,8 @@ public class ScaleDownDirectTest extends ClusterTestBase {
removeConsumer(1);
// at this point on node 0 there should be 2 messages in testQueue1 and 1 message in testQueue2
Assert.assertEquals(TEST_SIZE, getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName1))).getQueue()));
Assert.assertEquals(TEST_SIZE - 1, getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName2))).getQueue()));
Wait.assertEquals(TEST_SIZE, () -> getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName1))).getQueue()));
Wait.assertEquals(TEST_SIZE - 1, () -> getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName2))).getQueue()));
assertEquals(TEST_SIZE, performScaledown());
// trigger scaleDown from node 0 to node 1