NO-JIRA: trivial test fixes on AMQP

This commit is contained in:
Clebert Suconic 2017-05-12 14:36:01 -04:00
parent 5e6687e0e2
commit ac97d6f057
2 changed files with 14 additions and 5 deletions

View File

@ -24,11 +24,14 @@ import javax.jms.ExceptionListener;
import javax.jms.JMSException;
import org.apache.qpid.jms.JmsConnectionFactory;
import org.jboss.logging.Logger;
import org.junit.After;
import org.junit.Before;
public abstract class JMSClientTestSupport extends AmqpClientTestSupport {
private static final Logger logger = Logger.getLogger(JMSClientTestSupport.class);
protected LinkedList<Connection> jmsConnections = new LinkedList<>();
@Before
@ -44,12 +47,16 @@ public abstract class JMSClientTestSupport extends AmqpClientTestSupport {
@After
@Override
public void tearDown() throws Exception {
for (Connection connection : jmsConnections) {
try {
connection.close();
} catch (Throwable ignored) {
ignored.printStackTrace();
try {
for (Connection connection : jmsConnections) {
try {
connection.close();
} catch (Throwable ignored) {
ignored.printStackTrace();
}
}
} catch (Exception e) {
logger.warn(e);
}
jmsConnections.clear();

View File

@ -193,6 +193,8 @@ public class JMSTransactionTest extends JMSClientTestSupport {
session.rollback();
Wait.waitFor(() -> MSG_COUNT == queueView.getConsumerCount());
assertEquals(MSG_COUNT, queueView.getMessageCount());
// Consume again..check we receive all the messages.