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 javax.jms.JMSException;
import org.apache.qpid.jms.JmsConnectionFactory; import org.apache.qpid.jms.JmsConnectionFactory;
import org.jboss.logging.Logger;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
public abstract class JMSClientTestSupport extends AmqpClientTestSupport { public abstract class JMSClientTestSupport extends AmqpClientTestSupport {
private static final Logger logger = Logger.getLogger(JMSClientTestSupport.class);
protected LinkedList<Connection> jmsConnections = new LinkedList<>(); protected LinkedList<Connection> jmsConnections = new LinkedList<>();
@Before @Before
@ -44,6 +47,7 @@ public abstract class JMSClientTestSupport extends AmqpClientTestSupport {
@After @After
@Override @Override
public void tearDown() throws Exception { public void tearDown() throws Exception {
try {
for (Connection connection : jmsConnections) { for (Connection connection : jmsConnections) {
try { try {
connection.close(); connection.close();
@ -51,6 +55,9 @@ public abstract class JMSClientTestSupport extends AmqpClientTestSupport {
ignored.printStackTrace(); ignored.printStackTrace();
} }
} }
} catch (Exception e) {
logger.warn(e);
}
jmsConnections.clear(); jmsConnections.clear();
super.tearDown(); super.tearDown();

View File

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