NO-JIRA fixing tests

This commit is contained in:
Clebert Suconic 2019-08-22 11:59:44 -04:00
parent 777eede7ab
commit 3d7042d49a
3 changed files with 18 additions and 3 deletions

View File

@ -186,7 +186,7 @@ public class FailoverTest extends FailoverTestBase {
ClientSessionFactoryInternal sf1 = (ClientSessionFactoryInternal) createSessionFactory(locator); ClientSessionFactoryInternal sf1 = (ClientSessionFactoryInternal) createSessionFactory(locator);
final ClientSession session = createSession(sf1, true, true); final ClientSession session = createSession(sf1, true, false);
session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true);
@ -218,7 +218,13 @@ public class FailoverTest extends FailoverTestBase {
log.debug("acking message = id = " + message.getMessageID() + ", counter = " + log.debug("acking message = id = " + message.getMessageID() + ", counter = " +
message.getIntProperty("counter")); message.getIntProperty("counter"));
message.acknowledge(); message.acknowledge();
session.commit();
} catch (ActiveMQException e) { } catch (ActiveMQException e) {
try {
session.rollback();
} catch (Exception e2) {
e.printStackTrace();
}
e.printStackTrace(); e.printStackTrace();
return; return;
} }

View File

@ -46,6 +46,7 @@ import org.apache.activemq.artemis.core.server.ServerSession;
import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.Wait;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -414,16 +415,24 @@ public class ReconnectTest extends ActiveMQTestBase {
ClientConsumer clientConsumer2 = session.createConsumer(queueName1); ClientConsumer clientConsumer2 = session.createConsumer(queueName1);
clientConsumer1.close(); clientConsumer1.close();
Wait.assertEquals(1, () -> getConsumerCount(server, session));
Set<ServerConsumer> serverConsumers = server.getSessionByID(session.getName()).getServerConsumers(); Set<ServerConsumer> serverConsumers = server.getSessionByID(session.getName()).getServerConsumers();
ServerConsumer serverConsumer = serverConsumers.iterator().next(); ServerConsumer serverConsumer = serverConsumers.iterator().next();
assertEquals(1, serverConsumers.size());
assertEquals(clientConsumer2.getConsumerContext().getId(), serverConsumer.getID()); assertEquals(clientConsumer2.getConsumerContext().getId(), serverConsumer.getID());
session.close(); session.close();
sf.close(); sf.close();
server.stop(); server.stop();
} }
private int getConsumerCount(ActiveMQServer server, ClientSessionInternal session) {
Set<ServerConsumer> serverConsumers = server.getSessionByID(session.getName()).getServerConsumers();
return serverConsumers.size();
}
// Package protected --------------------------------------------- // Package protected ---------------------------------------------
// Protected ----------------------------------------------------- // Protected -----------------------------------------------------

View File

@ -266,7 +266,7 @@ public class SharedNothingReplicationFlowControlTest extends ActiveMQTestBase {
PageStoreFactoryTestable testablePageStoreFactory = (PageStoreFactoryTestable) ((PagingManagerImpl) backupServer.getPagingManager()).getPagingStoreFactory(); PageStoreFactoryTestable testablePageStoreFactory = (PageStoreFactoryTestable) ((PagingManagerImpl) backupServer.getPagingManager()).getPagingStoreFactory();
Assert.assertEquals(openCount.get(), closeCount.get()); Wait.assertTrue(() -> openCount.get() == closeCount.get());
} }
static AtomicInteger openCount = new AtomicInteger(0); static AtomicInteger openCount = new AtomicInteger(0);